On Fri, Dec 9, 2022 at 4:02 AM Mark Thomas <ma...@apache.org> wrote: > > On 08/12/2022 21:55, Aryeh Friedman wrote: > > I just tried the following command to test if tomcat does in fact listen on > > UDP: > > > > aryeh@sarek1024% nc -u localhost 8080 > > GET / HTTP/1.1 > > > > > > aryeh@sarek1024% > > > > Which is nice to see tomcat is listening > > That command doesn't do what you think it does. > > UDP doesn't work the way you think it does.
Please don't make assumptions about my background or about how I think UDP works. I have designed and implemented several transport protocols over UDP (in C not Java) see ecip.org. The man page for nc does take the connectionless nature of UDP into consideration. For example here is an nc session working with the echo server on UDP port 7: aryeh@sarek1024% nc -u 127.0.0.1 7 Hi there I am an echo Hi there I am an echo ^C > > Even if Tomcat was listening for UDP packets, HTTP/3 has a completely > different wire format to HTTP/1.1 and the above wouldn't work. I was not attempting to use HTTP (3 or 1.1). I was only testing if I got any response at all (or if I would get an ICMP Port Unavailable exception/error). For example the following code works against port 7 (UDP echo service) but not against 8080 (my local tomcat): import java.net.InetAddress; import java.net.InetSocketAddress; import java.net.DatagramPacket; import java.net.DatagramSocket; import java.net.SocketAddress; public class UDPHttp { public static void main(String[] args) throws Throwable { int port=7; DatagramSocket sock=new DatagramSocket(); InetAddress addr=InetAddress.getByName("localhost"); SocketAddress sockAddr=new InetSocketAddress(addr,port); sock.connect(sockAddr); String msg="GET / HTTP/1.1\r\n\r\n"; byte[] buf=msg.getBytes(); DatagramPacket packet= new DatagramPacket(buf,buf.length,sockAddr); sock.send(packet); byte[] out=new byte[buf.length]; packet=new DatagramPacket(out,out.length,sockAddr); sock.receive(packet); System.out.print(new String(out)); } } Yields the original value of msg Going to 8080 gives: Exception in thread "main" java.net.PortUnreachableException: ICMP Port Unreachable at java.net.PlainDatagramSocketImpl.receive0(Native Method) at java.net.AbstractPlainDatagramSocketImpl.receive(AbstractPlainDatagramSocketImpl.java:143) at java.net.DatagramSocket.receive(DatagramSocket.java:812) at UDPHttp.main(UDPHttp.java:29) > > Tomcat is NOT listening for UDP packets. > > Tomcat does not support HTTP/3 or QUIC. Any plans in this direction? -- Aryeh M. Friedman, Lead Developer, http://www.PetiteCloud.org --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org