Getting IP address and Port from UDP Packet
Asked Answered
A

1

11

I have a server set-up with netcat:

nc -l 4444 -u

And a client:

nc 127.0.0.1 4444 -u

I am using localhost because they are both on my computer, but if the client moves to another computer, is there a way for netcat to tell me the ip address and port number of the client?

Anjanetteanjela answered 25/7, 2012 at 16:52 Comment(0)
M
8

Use the -v or -vv for verbose logging, that will tell you client IP and port.

Mintun answered 25/7, 2012 at 16:56 Comment(3)
when I add -v to it but that does not seem to be working, I do not know if this matter but I am running it on a mac, I had to change localhost to 127.0.0.1 because localhost has stopped working altogether.Anjanetteanjela
Yes, BSD variant does not tell you that. Try GNU netcat (netcat.sourceforge.net) if you are so inclined.Mintun
same problem in windows if using Cygwin... solved using nc.exe from v1.12 NT eternallybored.org/misc/netcatFlock

© 2022 - 2024 — McMap. All rights reserved.