I want to check if one of a remote host server accepts UDP Packets on a specific port. With SocketServer I can set up a TCP/IP connection and it worked, but I must use UDP.
DatagramSocket ds;
DatagramPacket dp;
byte[] bytes = new byte[32];
InetAddress IAddress = new InetAddress.getByName("86.55.X.X");
ds = new DatagramSocket();
ds.setSoTimeout(100);
ds.connect(IAddress, 1122);
ds.send(dp);
ds.isConnected();
dp = new DatagramPacket(bytes, bytes.length);
ds.receive(dp);
ds.close();
The code above it should work, I don't know how to test it because I don't find any host/soft which/where I could run/test the code above. I'm trying to test it on a remote host. The remote host has Windows OS and Firewall disabled. It has a router and the firewall is also disabled. I can access the remote server and make changes in the router. My question is: can a remote host accept UDP packets if the only opened ports are for TCP/IP? (Port forward). In the router control panel I can make port forward for only TCP/IP.
localhost(127.0.0.1), which is your own computer. You can use Wireshark to check network activity. UDP is part of TCP/IP protocol stack. - m0skit0