internal MpxWinClientSocket(MpxClientTransport transport, IPEndPoint remoteServer, ClientSite clientSite, MpxSocketReceiveAction<MpxClientTransport> receiveAction) : base(transport, remoteServer, clientSite, receiveAction) { m_Client = new TcpClient(); m_Client.Connect(m_EndPoint); m_Socket = m_Client.Client; m_Client.NoDelay = true; m_Client.LingerState.Enabled = true; m_Client.LingerState.LingerTime = m_Transport.Binding.SocketLingerSec; m_Client.ReceiveBufferSize = m_Transport.Binding.ClientReceiveBufferSize; m_Client.SendBufferSize = m_Transport.Binding.ClientSendBufferSize; m_Client.ReceiveTimeout = m_Transport.Binding.ClientReceiveTimeout; m_Client.SendTimeout = m_Transport.Binding.ClientSendTimeout; //Send ClientSite right away m_SendChunk.Position = 0; var sz = m_ClientSite.Serialize( m_SendChunk ); m_Client.GetStream().Write(m_SendChunk.GetBuffer(), 0, sz); //------------------ m_RArgs = new SocketState(m_Client.Client, m_ReceiveChunk.GetBuffer()); m_RArgs.Completed += socketCallback; initiateReceive(); }
public override MpxClientSocket MakeClientSocket(MpxClientTransport transport, IPEndPoint remoteServer, ClientSite clientSite, MpxSocketReceiveAction<MpxClientTransport> receiveAction) { return new MpxWinClientSocket(transport, remoteServer, clientSite, receiveAction); }