public async void ConnectUDP(NetworkConnectionEndpoint remoteNetworkConnectionEndpoint) { if (!IsUDPSetup) { InitUDP(); } if (IsUDPConnected) { ResetUDP(); InitUDP(); } try { Debug.WriteLine("Binding UDPPort"); await m_datagramSocket.BindServiceNameAsync(remoteNetworkConnectionEndpoint.Port); Debug.WriteLine("Connecting UDPSocket"); await m_datagramSocket.ConnectAsync(remoteNetworkConnectionEndpoint.HostName, remoteNetworkConnectionEndpoint.Port); Debug.WriteLine("Creating UDPDataWriter"); m_udpDataWriter = new DataWriter(m_datagramSocket.OutputStream); Debug.WriteLine("Completed UDP"); UDPNetworkConnectionEndpoint = remoteNetworkConnectionEndpoint; IsUDPConnected = true; Debug.WriteLine("UDP Connected: " + UDPNetworkConnectionEndpoint.ToString()); } catch (Exception ex) { Debug.WriteLine(DebugTools.PrintOutException("ConnectUDP", ex)); } }
public async void StartTCPServer(NetworkConnectionEndpoint remoteNetworkConnectionEndpoint) { if (!IsTCPSetup) { InitTCP(); } if (IsTCPConnected) { ResetTCP(); InitTCP(); } try { Debug.WriteLine("Binding TCP Port"); await m_streamSocketListener.BindServiceNameAsync(remoteNetworkConnectionEndpoint.Port); TCPNetworkConnectionEndpoint = remoteNetworkConnectionEndpoint; Debug.WriteLine("TCP Connected: " + TCPNetworkConnectionEndpoint.ToString()); } catch (Exception ex) { Debug.WriteLine(DebugTools.PrintOutException("StartTCPServer", ex)); } }
public async void ConnectTCP(NetworkConnectionEndpoint remoteNetworkConnectionEndpoint) { if (!IsTCPSetup) { InitTCP(); } if (IsTCPConnected) { ResetTCP(); InitTCP(); } try { Debug.WriteLine("Connecting TCPSocket"); await m_streamSocket.ConnectAsync(remoteNetworkConnectionEndpoint.HostName, remoteNetworkConnectionEndpoint.Port); TCPNetworkConnectionEndpoint = remoteNetworkConnectionEndpoint; Debug.WriteLine("TCP Connected: " + TCPNetworkConnectionEndpoint.ToString()); await DoConnectTCP(); } catch (Exception ex) { Debug.WriteLine(DebugTools.PrintOutException("ConnectTCP", ex)); } }