public void InitClient()
 {
     SocketCallBack callback = new SocketCallBack();
     callback.callback += GetServerMessage;
     DemoCMDProcess process = new DemoCMDProcess( callback );
     this.dispatcher = new SocketEventDispatcher( process );
     this.client = new SocketClient();
     this.client.SocketMessageReceivedFromServer += new System.EventHandler<SocketMessageReceivedFromServer>( this.OnReceiveMessageFromServer );
     this.client.CreateConnectCompleted += new EventHandler<CreateConnectionAsyncArgs>( this.OnCreateConnectionComplete );
     this.client.CloseHandler += new EventHandler( this.CloseHandler );
     this.client.ConnectError += new EventHandler( this.ConnectError );
 }
Ejemplo n.º 2
0
    // Use this for initialization
    void Start()
    {
        SocketCallBack callback = new SocketCallBack();

        callback.callback += GetServerMessage;
        DemoCMDProcess process = new DemoCMDProcess(callback);

        this.diapatcher = new SocketEventDispatcher(process);
        this.client     = new SocketClient();
        this.client.SocketMessageReceivedFromServer += new EventHandler <SocketMessageReceivedFromServer>(this.OnReceiveMessageFromServer);
        this.client.CreateConnectCompleted          += new EventHandler <CreateConnectionAsyncArgs>(this.OnCreateConnectionComplete);
        this.client.CloseHandler += new EventHandler(this.CloseHandler);
        this.client.ConnectError += new EventHandler(this.ConnectError);
    }