public void reset()
		{
			if(valid())
			{
         	   _socket.Close(0);
			}
			_socket = null;
			_packetReceiver = null;
			_packetSender = null;
		}
Ejemplo n.º 2
0
        public bool send(byte[] datas)
        {
            if(!valid())
            {
               throw new ArgumentException ("invalid socket!");
            }

            if(_packetSender == null)
                _packetSender = new PacketSender(this);

            try
            {
                return _packetSender.send(datas);
            }
            catch (SocketException err)
            {
                Dbg.ERROR_MSG(string.Format("NetworkInterface::send(): socket error(" + err.ErrorCode + ")!"));
                close();
            }

            return false;
        }
        public bool send(MemoryStream stream)
        {
            if (!valid())
            {
                throw new ArgumentException("invalid socket!");
            }

            if (_packetSender == null)
                _packetSender = new PacketSender(this);

            return _packetSender.send(stream);
        }
 public void reset()
 {
     if(valid())
     {
         Dbg.DEBUG_MSG(string.Format("NetworkInterface::reset(), close socket from '{0}'", _socket.RemoteEndPoint.ToString()));
      	   _socket.Close(0);
     }
     _socket = null;
     _packetReceiver = null;
     _packetSender = null;
 }