creating new Socket with IPEndPoint
I am trying with a function which can send message to an ip and port using socket
while running this application i am getting an exception as - "{"Only one usage of each socket address (protocol/network address/port)\r\nis normally permitted" }"
Please help ...![]()
regards,
Vinu
the code like this, public {
String IP will be like this - 192.168.1.6:5763
{
string add = IP.Substring(0,IP.IndexOf(":"));int port =int.Parse(IP.Substring(IP.IndexOf(":")+1,IP.Length-IP.IndexOf(":")-1));IPAddress ipad = IPAddress.Parse(add);
Socket sk =
new Socket(AddressFamily.InterNetwork,SocketType.Stream,ProtocolType.Tcp);sk.Bind(
new IPEndPoint(ipad,ip));if(sk.Connected){
sk.Send(StringToByte(Message));
}
}
catch(Exception ex){
Console.WriteLine("\nException is : {0}",ex.Message);
}
}

