Skip to main content
gamedev.net
🔒 Locked

problems with java networking

Started by FreJa Nov 29, 2008 at 10:10 PM 1 replies 900+ views
Original Post
FreJa
FreJa
Hi, So I have 3 threads. In one of these threads I'm constantly calling receive on a UDP socket. On the other two I'm waiting with accept. Problem is, when receive times out, and launches SocketTimeoutException, IF I'm doing accept on one of the other two threads, the thread doing accept is suspended and the exception is handled (on the other thread)... Of course, I don't want this, I want to keep my accept running till the end. Any ideas? Thanks!
"Through me the road to the city of desolation,Through me the road to sorrows diuturnal,Through me the road among the lost creation."
Antheus
Antheus
So you have 3 sockets? 1 DatagramSocket and 2 ServerSockets?

I'm not really sure how accept() could impact UDP socket.
hplus0603
hplus0603
accept() is specific to TCP. You should be calling recvfrom() on a single socket when using UDP -- all remote clients will be sending to the same port and the same socket, and your server tells them apart by looking at the address you get out of recvfrom().
enum Bool { True, False, FileNotFound };

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.