I want to develop a Ip messenger app in VB.Net for all the user connected in LAN.
I am able to send message to user according to IP Address.
I want a functionality to list all the user which are connected(Using) to this app so that they can receive message.
How to check whether the person at other location is connected to the app or not.
I first used System.Net.NetworkInformation.Ping and PingReply to get whether user is available or not.
Without checking if i start sending message to a location which is not in use then Socket Exception is thrown when I try run connect user at particular port.
Dim tcpClient As New TcpClient(ip, 2828)
Also error is returned after delay if I write this code in try catch block. Is there any quick way to check whether there is a listener at a particular given port?
if this is simply for LAN use, I would recommend looking into UDP broadcasts. Have each client broadcast its availability on the network once per second.. then you can update your local availability display based on time since last update packet. On sending a packet with a message, listen for an application ACK. If you dont get one in say 5 sec, indicate a failed delivery.