This week's book giveaway is in the Agile and other Processes forum. We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line! See this thread for details.
Is it possible for multiple threads to access the same socket descriptor,to send different messages, without any synchronization issues??
The messages are sent over TCP/IP.
Stan James
(instanceof Sidekick)
Ranch Hand
Joined: Jan 29, 2003
Posts: 8791
posted
0
You'd want a "synchronized" clause around any reads or writes to make sure you send a complete message or receive a complete message with no interferance from other threads. You're kinda doing your own multiplexing. It will be an interesting server on the other end that can figure out the inbound messages!
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Yaroslav Chinskiy
Ranch Hand
Joined: Jan 09, 2001
Posts: 147
posted
0
You can try to create a queue and queue reader that sends data over the sockets. The other threads will put messages on that queue.
Priya Vasudevan
Greenhorn
Joined: Mar 19, 2004
Posts: 17
posted
0
Originally posted by Yaroslav Chinskiy: You can try to create a queue and queue reader that sends data over the sockets. The other threads will put messages on that queue.
Multiple threads on the client side need to establish connection to different servers.If thread T1 needs to send data to IP1 and thread T2 also needs to send data to IP1, T2 needs to wait for the socket descriptor to get free. Would it improve performance by opening multiple socket descriptors for each Thread,on the client end, so that simultaneously messages can be sent??
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.