Exemple #1
0
        public int SendMessage(System.Net.Sockets.Socket sender)
        {
            Enum MessageType = Message.MessageType.Message; // the type of message where sending here is a text message.
            Message msg = new Message();

            string sdfsa = GetMessageFromStream();

            byte[] message = Encoding.ASCII.GetBytes(sdfsa + "<EOF>");
            int sent = sender.Send(message);

            return sent;
        }
Exemple #2
0
        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;
        }