Valhalla Legends Archive

Programming => General Programming => Topic started by: Banana fanna fo fanna on May 26, 2003, 09:04 AM

Title: Two sockets binding to the same port?
Post by: Banana fanna fo fanna on May 26, 2003, 09:04 AM
Is it possible to have two processes (say, oh, Brood War and a gamebot) to bind to the same UDP port? I don't think so, but is there another solution that would work?

It also seems that even if I bind first, Brood War takes it over. ANy suggestions would be much appreciated.
Title: Re:Two sockets binding to the same port?
Post by: Skywing on May 26, 2003, 11:32 AM
Quote from: St0rm.iD on May 26, 2003, 09:04 AM
Is it possible to have two processes (say, oh, Brood War and a gamebot) to bind to the same UDP port? I don't think so, but is there another solution that would work?

It also seems that even if I bind first, Brood War takes it over. ANy suggestions would be much appreciated.
Yes, you can with UDP.  However, you need to set a special flag (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winsock/winsock/using_so_exclusiveaddruse.asp), so Brood War would need to bind the socket first.
Title: Re:Two sockets binding to the same port?
Post by: tA-Kane on May 27, 2003, 03:07 PM
Quote from: St0rm.iD on May 26, 2003, 09:04 AMIt also seems that even if I bind first, Brood War takes it over.
That's interesting. On my Mac, Brood War increments the UDP port (eg, use 6113).
Title: Re:Two sockets binding to the same port?
Post by: iago on May 27, 2003, 04:13 PM
It does that on mine, too, if port 6112 is in use it uses 6113.
Title: Re:Two sockets binding to the same port?
Post by: Banana fanna fo fanna on May 27, 2003, 08:36 PM
Yeah i figured that out.