public int SendIP(System.Net.Sockets.Socket sender) { Message msg = new Message(); string HostIpAddress = Net.GetHostIpAddress(); // the type of message where sending here is a Ip address. string type = "type:" + msg.GetMessageTypeByName(Message.MessageType.SentIP); byte[] message = Encoding.ASCII.GetBytes(HostIpAddress + " connected. " + type + Chat.EOF_FLAG); int sent = sender.Send(message); return sent; }