Beispiel #1
0
        //Action<Exception> onHandshakeError;

        public SocketListener(ActionSyncronizerProxy sync, Action <Handshake, Socket> processConnection, Socket sckListen)
        {
            using (var h = DisposeHandle.Get(sckListen))
            {
                this.sckListen         = sckListen;
                this.processConnection = sync.Convert(processConnection);
                //this.onHandshakeError = onHandshakeError;

                ThreadManager.NewThread(() => ProcessThread(),
                                        () => TerminateThread(), "SocketListener " + NetTools.GetLocalIP(sckListen).ToString());

                h.Disengage();
            }
        }
Beispiel #2
0
        public SocketReader(ActionSyncronizerProxy sync,
                            Action <MemoryStream> messageProcessor, Action <IOException> errorResponse, Action onSoftDisconnect,
                            Socket socketRead)
        {
            using (var h = DisposeHandle.Get(socketRead))
            {
                this.onSoftDisconnect = sync.Convert(onSoftDisconnect);
                this.messageProcessor = sync.Convert(messageProcessor);
                this.errorResponse    = sync.Convert(errorResponse);

                this.socketRead = socketRead;

                ThreadManager.NewThread(() => this.ProcessThread(),
                                        () => TerminateThread(), "SocketReader " + NetTools.GetRemoteIP(socketRead).ToString());
                h.Disengage();
            }
        }