private void _socket_ConnectionReceived(Socket newSocket) { var socketConnection = new NKC_SocketTCP(newSocket, this); connections.Add(socketConnection); _emitConnection(socketConnection); socketConnection._receiveData(); }
private void _socket_ConnectionReceived(StreamSocketListener sender, StreamSocketListenerConnectionReceivedEventArgs args) { var socketConnection = new NKC_SocketTCP(args.Socket, this); connections.Add(socketConnection); // args.Socket.setDelegate(socketConnection, delegateQueue: NKScriptChannel.defaultQueue _emitConnection(socketConnection); var _ = socketConnection._receiveData(); }
public void close() { if (_socket != null) { _socket.Dispose(); } if (_server != null) { _server.close(); } _socket = null; _server = null; }
public async static Task addCorePlatform(NKScriptContext context, Dictionary <string, object> options) { entryType = (System.Type)options["NKS.Entry"]; // PROCESS SHOULD BE FIRST CORE PLATFORM PLUGIN await NKC_Process.attachToContext(context, options); // LOAD REMAINING CORE PLATFORM PLUGINS await NKC_FileSystem.attachToContext(context, options); // await NKC_Console.attachToContext(context, options); await NKC_Crypto.attachToContext(context, options); await NKC_SocketTCP.attachToContext(context, options); await NKC_SocketUDP.attachToContext(context, options); await NKC_Timer.attachToContext(context, options); }
public NKC_SocketTCP(Socket socket, NKC_SocketTCP server) { _socket = socket; _server = server; }
private void _emitConnection(NKC_SocketTCP tcp) { this.getNKScriptValue().invokeMethod("emit", new object[] { "connection", tcp }); }
// private methods private void _connectionDidClose(NKC_SocketTCP socketConnection) { this.connections.Remove(socketConnection); }
public NKC_SocketTCP(StreamSocket socket, NKC_SocketTCP server) { _socket = socket; _server = server; }
private void _emitConnection(NKC_SocketTCP tcp) { var js = this.getNKScriptValue(); js.invokeMethod("emit", new object[] { "connection", tcp }); }
public void close() { if (_socketListener != null) _socketListener.Dispose(); if (_socket != null) _socket.Dispose(); if (_server != null) _server.close(); _socketListener = null; _socket = null; _server = null; }