Esempio n. 1
0
    public Connection(Socket inSock, delVoidString DisconnectFunc, delVoidString ErrorFunc, delVoidLineSegment OutputLine)
    {
        connection    = inSock;
        Disconnect    = DisconnectFunc;
        ErrorOccurred = ErrorFunc;
        OutputLineSeg = OutputLine;

        Thread thread = new Thread(ThreadReading);

        thread.IsBackground = true;
        thread.Start();

        thread = new Thread(ProcessThread);
        thread.IsBackground = true;
        thread.Start();
    }
Esempio n. 2
0
    public Connection(string Address, int Port, delVoidString DisconnectFunc, delVoidString ErrorFunc, delVoidLineSegment OutputLine)
    {
        try
        {
            connection = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
        }
        catch (Exception err)
        {
            ErrorOccurred(err.Message);
            return;
        }

        Disconnect    = DisconnectFunc;
        ErrorOccurred = ErrorFunc;
        OutputLineSeg = OutputLine;

        EstablishConnection(Address, Port);
    }