public void Ping(IPAddress address, int port) { Address = address; Port = port; var bytes = new byte[1]; bytes[0] = 0; socket.SendTo(bytes, address, port); }
private void Connection() { try { _socket.Start(localIp.text, int.Parse(localPort.text)); _socket.SendTo(serverIp.text, int.Parse(serverPort.text), Message.CreateOldConnectionMessage(serverPassword.text, int.Parse(localPort.text), true) .ToJson()); } catch (Exception e) { Console.WriteLine(e); } }
public static void Send(byte[] data, IPEndPoint remote) { UdpSocket.SendTo(data, remote); }