Hello Dave,

Thanx  for  this  long  answer,  I  am already aware of all the way it
"should"  be  done,  but  I  have  to work on a very old client/server
project  for  which  the  sources has been lost, so I need to keep the
same  way  it  actually  works and do the patch thru a proxy that will
emulate the original server way of managing it's UDP protocol.

Neverless, I found a workaround.


DB> Unless you are using an existing known protocol, in which case you'd
DB> idealy use one of the recognised existing port numbers....   Port 80,
DB> 8008, 8080 for an HTTP server for example.

DB> Letting the system pick a random port to listen on as a server is a bit
DB> unproductive, as how would you inform any likely clients (not on the
DB> same machine) what server port to connect to?...

DB> Best I think to pick a specific port number to start with for the server
DB> to create and listen on, and then let the clients pick a unused port for
DB> them to talk with, to "connect" to your server that is listnening on a
DB> known port.   (UDP is a "connectionless" protocol of course)

DB> It is posible to use the same port number to talk and listen on, but not
DB> generaly on the same physical machine for both a client and server,
DB> something has to be different between them, either the IP address, or
DB> port number (or both)   Or, the system hasn't a clue as to who what
DB> where etc...

DB> I guess you could define another localhost address, for
DB> example perhaps?  AFIK there is no reason why a single machine can't
DB> have multiple "local loopback" addresses.  Unless someone else knows
DB> different.  Then you could use the same "Port" number for both client
DB> and server, with care...

DB> Check out...
DB> http://www.iana.org/assignments/port-numbers

DB> For typical known port numbers, some may be of use, many are worth
DB> avoiding!  (to keep script kiddies away, and to avoid strange connect
DB> requests)...

DB> Note, that ports in the range of...
DB> 49152 through 65535 are avaialable for "Private or Dynamic" port
DB> assignments.   You can use any of them for anything, and being way up
DB> there in "High Port Land" should be well out of the way of any malicious
DB> port scanners looking for something to play with....

DB> Hope something helps..

DB> Cheers.

DB> Dave B.


>> -----Original Message-----
>> From: Dod [mailto:[EMAIL PROTECTED] 
>> Sent: Thursday, March 06, 2008 2:48 PM
>> To: ICS support mailing
>> Subject: [twsocket] Problem using same UDP port for both 
>> listen and send
>> Hello,
>> I am working on something like :
>> -  Create Server UDP socket port 0 - Winsock select the 
>> listening port itself
>> - I retrieve port number using GetSockName/.sin_port
>> - The Socket server is now listening
>> -  I  create  a  Socket  client  to connect to other machine 
>> but I set LocalPort  with  same  socket  number  as  the one 
>> retrieved by server socket
>> - I .Connect the client to other machine and .Send the data
>> All works fine on XP but the final program must run on NT4 
>> and if I do this I get WSAEADDRINUSE ( 10048 ) Address already in use.
>> If i set LocalPort to 0 before .Connect then all is fine of course.
>> Any idea why NT4 cannot not set localport for UDP sending 
>> with same number as port used by a server socket ? May be an 
>> old NT4 Winsock limitation ?
>> I know NT4 is old but I have to work on a very old server 
>> that can't be upgraded. May be some of you remember such limitation ?
>> Regards.
DB> This mail has been scanned by Palmer Cook Computer Services Limited.  

To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be

Reply via email to