|
-
May 23rd, 2006, 08:55 AM
#1
Single UDP socket, multiple connections
I'm coding a game server query for UT2004 and I have my program sending a server-info query via UDP to about a dozen servers.
I have one single UDP socket sending all the data at the same time just fine, and Ethereal shows me all the servers are sending query results back...BUT it appears that I need to create multiple sockets, one set for each server IP, so that I can receive the data in the code.
What I originally attempted to do was have just one UDP socket, receiving all data from each different IP....however this only works for sending and not receiving, does anyone know how I could do that? (perhaps a special socket option?)
Thanks.
EDIT: I know the topic name is a bit misleading, as UDP doesn't use 'connections'.
Last edited by Shambler; May 23rd, 2006 at 08:57 AM.
-
May 23rd, 2006, 11:51 AM
#2
Re: Single UDP socket, multiple connections
For UDP, the docs say that you should be able to recvfrom() multiple different IPs on a single socket unless you have called connect() for that socket, in which case all datagrams from a source different from the connected-to socket will be discarded/ignored.
Did you call connect()?
Mike
-
May 23rd, 2006, 12:11 PM
#3
Re: Single UDP socket, multiple connections
Ah yes, I did (didn't know using Connect with UDP sockets would do that)
The reason I used 'Connect' was so that I could send data to a specific IP and port, after just checking the help file again I've now realised I should have been using SendTo instead of Connect and Send 
Problem resolved, thanks!
-
February 24th, 2008, 01:11 PM
#4
Re: Single UDP socket, multiple connections
Hello,
This is a similar question.
Can anyone explain when you would use the connect() statement with UDP ?
Is it more efficient or something?
How much data can a single port handle? If I want to send many messages from one pc to another at the same , do I have to
1) create socket
2) bind
3)connect
for each individual type of message?
If not, then how do I handle different messages on the receive and send sides?
-
February 24th, 2008, 04:13 PM
#5
Re: Single UDP socket, multiple connections
I think it is common sense not to "hijack" a thread. Please post your question in a separate thread and you might get an answer.
-
February 24th, 2008, 04:56 PM
#6
Re: Single UDP socket, multiple connections
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|