Re: Unmatched speed of socket sending and receiving



Yao wrote:
) We write java program to send some data out by socket, and write C
) program receive these data from socket. The java program is
) multithreaded, and send a lot of number of data by socket, while C
) program is single-threaded.
)
) Every time, C program reads data from socket, unpack them, and insert
) these data into some lists to maintain them. The speed of receiver (C
) program) is not matched to Java program, so the C program slows down the
) execution of Java program, because C program could NOT read the data
) from socket as soon as possible.
)
) The local buffer has been used in Java program. Before send data by
) socket, they are saved in local buffer at first, and send them together
) when buffer is full.
)
) How could I improve the performance of C program here? Does it help if
) I write this C program in a multhreaded way? Thanks for your advice.

Assuming that the C code in itself is reasonably near optimal, then the
only place to improve performance would be when the C program is waiting
for something (writes to disk, for example, or reading from sockets).

If the C program is burning 100% CPU, then the only way to improve would
be to improve the processing speed itself.

This can be easily checked by looking at the C program's CPU usage.

By the way, if the two are running on the same processor, then of course
you have the problem that they are contending for the same CPU resource,
which makes for a lot more issues.


SaSW, Willem
--
Disclaimer: I am in no way responsible for any of the statements
made in the above text. For all I know I might be
drugged or something..
No I'm not paranoid. You all think I'm paranoid, don't you !
#EOT
.



Relevant Pages

  • Re: Embedded java ?
    ... Could I write a Java program to run on a cell phone and open a socket ... our unix machine. ...
    (comp.lang.java.help)
  • Re: c prog socket connect to java program
    ... [invalid group com.lang.java.developer removed] ... > my c program wants to send a message to java program through socket. ... and read again in a loop until the entire message has been ...
    (comp.lang.java.programmer)
  • Re: Unmatched speed of socket sending and receiving
    ... We write java program to send some data out by socket, ... The local buffer has been used in Java program. ... This can be easily checked by looking at the C program's CPU usage. ...
    (comp.programming)
  • Re: Unmatched speed of socket sending and receiving
    ... program receive these data from socket. ... program) is not matched to Java program, so the C program slows down the ... The local buffer has been used in Java program. ... multi-processor system, ...
    (comp.programming)
  • Re: TEST and thanks
    ... What's this project consist of (other than a P66 CPU)? ... Oh well) I thought at the time that I had a bunch of Socket ... extraordinary details of rounding up about 20 motherboards so far. ...
    (comp.sys.ibm.ps2.hardware)