object SECURITYSERVER_OnSocketReceive_0(Object __Info__) { SocketEventInfo __SocketInfo__ = (SocketEventInfo)__Info__; try { SplusExecutionContext __context__ = SplusThreadStartCode(__SocketInfo__); short FILEHANDLE = 0; short COUNT = 0; CrestronString BUFFER; BUFFER = new CrestronString(InheritedStringEncoding, 8192, this); __context__.SourceCodeLine = 28; Functions.ClearBuffer(SECURITYSERVER.SocketRxBuf); __context__.SourceCodeLine = 30; BUFFER.UpdateValue("<?xml version=\u00221.0\u0022?>\u000A\u000D<!DOCTYPE cross-domain-policy SYSTEM \u0022/xml/dtds/cross-domain-policy.dtd\u0022>\u000A\u000D<!-- Policy file for xmlsocket://socks.example.com -->\u000A\u000D<cross-domain-policy>\u000A\u000D<!-- This is a master-policy file -->\u000A\u000D<site-control permitted-cross-domain-policies=\u0022master-only\u0022/>\u000A\u000D<!-- Instead of setting to-ports=\u0022*\u0022,administrators can use ranges and commas -->\u000A\u000D<allow-access-from domain=\u0022*\u0022 to-ports=\u0022*\u0022 />\u000A\u000D</cross-domain-policy>\u0000"); __context__.SourceCodeLine = 31; Functions.SocketSend(SECURITYSERVER, BUFFER); } catch (Exception e) { ObjectCatchHandler(e); } finally { ObjectFinallyHandler(__SocketInfo__); } return(this); }
public void StartForTestOnly(int port, System.Threading.CancellationToken token) { _udpThread = new System.Threading.Thread(() => _udpReceiver.ReceiveStuff(token)); _udpThread.Start(); System.Net.Sockets.TcpListener serverSocket = new System.Net.Sockets.TcpListener(System.Net.IPAddress.Any, port); SocketEventInfo?.Invoke("Listening"); System.Net.Sockets.TcpClient clientSocket = default(System.Net.Sockets.TcpClient); int clientId = 0; serverSocket.Start(); clientId = 0; while (!token.IsCancellationRequested) { clientId += 1; clientSocket = serverSocket.AcceptTcpClient(); _log.Debug($"New TCP Client connected"); System.Threading.Thread thread = new System.Threading.Thread(() => StartServerMessengerForTest(clientSocket, clientId, token)); thread.Start(); } clientSocket.Close(); serverSocket.Stop(); SocketEventInfo?.Invoke("Closed"); }
object MYCLIENT_OnSocketReceive_5(Object __Info__) { SocketEventInfo __SocketInfo__ = (SocketEventInfo)__Info__; try { SplusExecutionContext __context__ = SplusThreadStartCode(__SocketInfo__); __context__.SourceCodeLine = 147; if (Functions.TestForTrue((Functions.BoolToInt(Functions.Length(MYCLIENT.SocketRxBuf) < 256)))) { __context__.SourceCodeLine = 149; Print("Rx: {0}", MYCLIENT.SocketRxBuf); } __context__.SourceCodeLine = 155; SOCLIENTRX.UpdateValue(MYCLIENT.SocketRxBuf); __context__.SourceCodeLine = 157; Functions.ClearBuffer(MYCLIENT.SocketRxBuf); } catch (Exception e) { ObjectCatchHandler(e); } finally { ObjectFinallyHandler(__SocketInfo__); } return(this); }
object MYCLIENT_OnSocketDisconnect_3(Object __Info__) { SocketEventInfo __SocketInfo__ = (SocketEventInfo)__Info__; try { SplusExecutionContext __context__ = SplusThreadStartCode(__SocketInfo__); __context__.SourceCodeLine = 113; DOCLIENTCONNECTED.Value = (ushort)(0); __context__.SourceCodeLine = 115; if (Functions.TestForTrue((DISTARTCLIENT.Value))) { __context__.SourceCodeLine = 117; Print("Socket disconnected remotely"); } else { __context__.SourceCodeLine = 121; Print("Local disconnect complete."); } } catch (Exception e) { ObjectCatchHandler(e); } finally { ObjectFinallyHandler(__SocketInfo__); } return(this); }
object MYCLIENT_OnSocketConnect_2(Object __Info__) { SocketEventInfo __SocketInfo__ = (SocketEventInfo)__Info__; try { SplusExecutionContext __context__ = SplusThreadStartCode(__SocketInfo__); int PORTNUMBER = 0; short LOCALSTATUS = 0; CrestronString REMOTEIPADDRESS; REMOTEIPADDRESS = new CrestronString(Crestron.Logos.SplusObjects.CrestronStringEncoding.eEncodingASCII, 20, this); CrestronString REQUESTEDADDRESS; REQUESTEDADDRESS = new CrestronString(Crestron.Logos.SplusObjects.CrestronStringEncoding.eEncodingASCII, 256, this); __context__.SourceCodeLine = 75; DOCLIENTCONNECTED.Value = (ushort)(1); __context__.SourceCodeLine = 77; LOCALSTATUS = (short)(Functions.SocketGetAddressAsRequested(MYCLIENT, ref REQUESTEDADDRESS)); __context__.SourceCodeLine = 79; if (Functions.TestForTrue((Functions.BoolToInt(LOCALSTATUS < 0)))) { __context__.SourceCodeLine = 81; Print("Error getting remote ip address. {0:d}\r\n", (short)LOCALSTATUS); } __context__.SourceCodeLine = 83; Print("OnConnect: Connect call to {0} successful\r\n", REQUESTEDADDRESS); __context__.SourceCodeLine = 87; PORTNUMBER = (int)(Functions.SocketGetPortNumber(MYCLIENT)); __context__.SourceCodeLine = 89; if (Functions.TestForTrue((Functions.BoolToInt(PORTNUMBER < 0)))) { __context__.SourceCodeLine = 91; Print("Error getting client port number. {0:d}\r\n", (int)PORTNUMBER); } __context__.SourceCodeLine = 95; LOCALSTATUS = (short)(Functions.SocketGetRemoteIPAddress(MYCLIENT, ref REMOTEIPADDRESS)); __context__.SourceCodeLine = 97; if (Functions.TestForTrue((Functions.BoolToInt(LOCALSTATUS < 0)))) { __context__.SourceCodeLine = 99; Print("Error getting remote ip address. {0:d}\r\n", (short)LOCALSTATUS); } __context__.SourceCodeLine = 101; Print("OnConnect: Connected to port {0:d} on address {1}\r\n", (int)PORTNUMBER, REMOTEIPADDRESS); __context__.SourceCodeLine = 105; Functions.SocketSend(MYCLIENT, "This is sent when the socket starts."); } catch (Exception e) { ObjectCatchHandler(e); } finally { ObjectFinallyHandler(__SocketInfo__); } return(this); }
object MYSERVER_OnSocketDisconnect_4(Object __Info__) { SocketEventInfo __SocketInfo__ = (SocketEventInfo)__Info__; try { SplusExecutionContext __context__ = SplusThreadStartCode(__SocketInfo__); __context__.SourceCodeLine = 204; DOSERVERCONNECTED = (short)(0); } catch (Exception e) { ObjectCatchHandler(e); } finally { ObjectFinallyHandler(__SocketInfo__); } return(this); }
object NTPSERVER_OnSocketReceive_1(Object __Info__) { SocketEventInfo __SocketInfo__ = (SocketEventInfo)__Info__; try { SplusExecutionContext __context__ = SplusThreadStartCode(__SocketInfo__); __context__.SourceCodeLine = 609; Functions.SocketGetSenderIPAddress(NTPSERVER, ref TEMPRXIP__DOLLAR__); __context__.SourceCodeLine = 612; if (Functions.TestForTrue((Functions.BoolToInt(Functions.Length(NTPSERVER.SocketRxBuf) >= 48)))) { __context__.SourceCodeLine = 614; if (Functions.TestForTrue((PROCESSDATA(__context__, Functions.Left(NTPSERVER.SocketRxBuf, (int)(48)))))) { __context__.SourceCodeLine = 616; CancelWait("SERVERWAIT"); __context__.SourceCodeLine = 618; Functions.ClearBuffer(NTPSERVER.SocketRxBuf); __context__.SourceCodeLine = 619; Functions.SocketUDP_Disable(NTPSERVER); __context__.SourceCodeLine = 621; SYNCSUCCESSFUL [CURRSERVER].Value = (ushort)(1); __context__.SourceCodeLine = 622; Functions.ProcessLogic( ); __context__.SourceCodeLine = 623; SYNCSUCCESSFUL [CURRSERVER].Value = (ushort)(0); __context__.SourceCodeLine = 625; CURRSERVER = (ushort)(0); __context__.SourceCodeLine = 626; BUSY.Value = (ushort)(0); } } __context__.SourceCodeLine = 630; if (Functions.TestForTrue((DEBUG.Value))) { __context__.SourceCodeLine = 631; Print("[NTP.SOCKETRECEIVE] Received data from: {0}\r\n", TEMPRXIP__DOLLAR__); } } catch (Exception e) { ObjectCatchHandler(e); } finally { ObjectFinallyHandler(__SocketInfo__); } return(this); }
object MYSERVER_OnSocketConnect_3(Object __Info__) { SocketEventInfo __SocketInfo__ = (SocketEventInfo)__Info__; try { SplusExecutionContext __context__ = SplusThreadStartCode(__SocketInfo__); __context__.SourceCodeLine = 199; DOSERVERCONNECTED = (short)(1); __context__.SourceCodeLine = 200; Print("OnConnect: input buffer size is: {0:d}\r\n", (short)Functions.Length(MYSERVER.SocketRxBuf)); } catch (Exception e) { ObjectCatchHandler(e); } finally { ObjectFinallyHandler(__SocketInfo__); } return(this); }
object MYSERVER_OnSocketReceive_6(Object __Info__) { SocketEventInfo __SocketInfo__ = (SocketEventInfo)__Info__; try { SplusExecutionContext __context__ = SplusThreadStartCode(__SocketInfo__); __context__.SourceCodeLine = 216; INTERNALRXBUFFER.UpdateValue(INTERNALRXBUFFER + MYSERVER.SocketRxBuf); __context__.SourceCodeLine = 217; Functions.ClearBuffer(MYSERVER.SocketRxBuf); __context__.SourceCodeLine = 218; SOCKETRX(__context__); } catch (Exception e) { ObjectCatchHandler(e); } finally { ObjectFinallyHandler(__SocketInfo__); } return(this); }
object MYSERVER_OnSocketStatus_5(Object __Info__) { SocketEventInfo __SocketInfo__ = (SocketEventInfo)__Info__; try { SplusExecutionContext __context__ = SplusThreadStartCode(__SocketInfo__); short STATUS = 0; __context__.SourceCodeLine = 209; STATUS = (short)(__SocketInfo__.SocketStatus); __context__.SourceCodeLine = 211; Print("The SocketGetStatus returns: {0:d}\r\n", (short)STATUS); __context__.SourceCodeLine = 212; Print("The MyServer.SocketStatus returns: {0:d}\r\n", (short)MYSERVER.SocketStatus); } catch (Exception e) { ObjectCatchHandler(e); } finally { ObjectFinallyHandler(__SocketInfo__); } return(this); }
public bool Connect(string ipAddress, int port) { try { _clientSocket.Connect(ipAddress, port); SocketEventInfo?.Invoke("Connected"); testConnect = true; System.Threading.Thread thread = new System.Threading.Thread(() => GetStream(_cancelToken)); thread.Start(); //var publicKey = encryptioinKeys.ExportPublicKey(); //System.Threading.Thread.Sleep(100); //_log.Debug("Sending RSA Public Key"); //CallReceivedDataLog("Sending RSA Public Key"); //SendObjectToTcpClient(new TanksCommon.Encryption.RsaPublicKey() { Key = publicKey }); return(true); } catch { SocketEventInfo?.Invoke("Failed"); testConnect = false; return(false); } }
object MYCLIENT_OnSocketStatus_4(Object __Info__) { SocketEventInfo __SocketInfo__ = (SocketEventInfo)__Info__; try { SplusExecutionContext __context__ = SplusThreadStartCode(__SocketInfo__); short STATUS = 0; __context__.SourceCodeLine = 133; STATUS = (short)(__SocketInfo__.SocketStatus); __context__.SourceCodeLine = 135; AOCLIENTSTATUS.Value = (ushort)(STATUS); __context__.SourceCodeLine = 137; Print("The SocketGetStatus returns: {0:d}\r\n", (short)STATUS); __context__.SourceCodeLine = 139; Print("The MyClient.SocketStatus returns: {0:d}\r\n", (short)MYCLIENT.SocketStatus); } catch (Exception e) { ObjectCatchHandler(e); } finally { ObjectFinallyHandler(__SocketInfo__); } return(this); }
private void _serverComManager_SocketEventInfo(string socketEvent) { SocketEventInfo?.Invoke(socketEvent); }
private void _mainServerMessenger_SocketEventInfo(string socketEvent) { SocketEventInfo?.Invoke(socketEvent); }