Esempio n. 1
0
		protected static void dMesg( LogArgs LArgs )
		{
            /*
			Send( new DnsEndPoint( "2.astropneguin.net", 9730 ), LArgs );
			/*/
            Send( new IPEndPoint( IP, 9730 ), LArgs );
			//*/
		}
Esempio n. 2
0
		/// <summary>
		/// Send the given data to the server using the established connection
		/// </summary>
		/// <param name="serverName">The name of the server</param>
		/// <param name="portNumber">The number of the port over which to send the data</param>
		/// <param name="data">The data to send to the server</param>
		/// <returns>The result of the Send request</returns>
		protected static void Send( EndPoint Ep, LogArgs LArgs )
		{
			if ( soc != null )
			{
				SocketAsyncEventArgs socketEventArg = new SocketAsyncEventArgs();
				socketEventArg.RemoteEndPoint = Ep;
				socketEventArg.Completed += ( object s, SocketAsyncEventArgs e ) => {
					if ( LArgs.sig == Signal.EXIT ) End();
				};

				byte[] payload = Encoding.UTF8.GetBytes( LArgs.LogStamp );
				socketEventArg.SetBuffer( payload, 0, payload.Length );
				soc.SendToAsync( socketEventArg );
			}
		}