public QSocket Connect(string host) { if (host != "local") { return(null); } _LocalConnectPending = true; if (_Client == null) { _Client = Net.NewSocket(); if (_Client == null) { Con.Print("Loop_Connect: no qsocket available\n"); return(null); } _Client.address = "localhost"; } _Client.ClearBuffers(); _Client.canSend = true; if (_Server == null) { _Server = Net.NewSocket(); if (_Server == null) { Con.Print("Loop_Connect: no qsocket available\n"); return(null); } _Server.address = "LOCAL"; } _Server.ClearBuffers(); _Server.canSend = true; _Client.driverdata = _Server; _Server.driverdata = _Client; return(_Client); }
public void Close(QSocket sock) { if (sock.driverdata != null) { ((QSocket)sock.driverdata).driverdata = null; } sock.ClearBuffers(); sock.canSend = true; if (sock == _Client) { _Client = null; } else { _Server = null; } }