Re: UDP Port 137 Questions
It has been a while since I've done this, but can't you simply send a broadcast message to an IP address?
In any case, here is a good reference on just these types of things:
http://vbnet.mvps.org/code/network/index.html
Re: UDP Port 137 Questions
Just recently I opened again my old program that has this problem and after searching over and over again on the net I found something that might solve this problem so I am resurrecting this thread to help others that might have the same problem.
One possible solution for this is to use UDP port, in my case I used 27010 (half-life) for local port socket and 27011 for remote port socket. The program listen to the port 27010 so all the computers in the network listens to it. If I want to send a message using username, the program broadcast the username. Since every computer is listening on the same port, it ask a question if that username is logged in on that computer. The computer who matches the username reply with the computername to the sender of the message then it will be used in the mailslot portion (\\computername\mailslot\messngr) to send the message.
I got the idea from a program written by Michael Ciurescu (CVMichael) - Autofind a client-server simple chat program that locates a chat server by issuing a UDP broadcast then giving the IP address to the client to connect. Thanks to him.
Now I am thinking of what could be the effect of opening that port if there are around 200 computers in the network, will that cause too much traffic on the network ? Should I just use UDP port 137 ?
I am also thinking about Realpopup where everytime a user logged in, it informs everybody on the net. Does it also use the same concept ?
Re: UDP Port 137 Questions
Yes there are performance issues. One possibility is to use either a UDP port (or better a mailslot) that everyone listens on.
When a peer wants to know where a user is, he can do a broadcast "ping" requesting the user's location and get back a response (or time out) on the same "channel" himself:
Broadcast: ?<requesting host name>;<requested user>
Narrow reply to requesting host: !<replying hostname>;<requested user>
To keep traffic down each peer could cache these.
One could also arrange to have a new peer starting up broadcast the ! message to all peers. Maybe even have a # message sent out when a peer terminates (user not here anymore). If a peer tries to use a cached destination and fails or times out it can delete the cached entry.