I am testing a device (a GPS tracking) that is sending data (the GPS position) to a given IP on a given port. I don't know what kind of data format it sends, is there a way to listen on my CentOS server for incoming data on a given port and maybe print it on screen ?
Monitoring a given port for unknown incoming data
916 views Asked by adrianTNT At
2
Expanding on the comment I left earlier (at the time I could not test): if you have access to Python on your machine, you can create the following simple script - e.g. in a file you call
myServer.py
(attribution: http://ilab.cs.byu.edu/python/socket/echoserver.html - you will find much more information about Python network programming there; well worth a visit):When I ran this on my Mac by typing
And then went to my browser where I typed
I got the following in my browser:
And my console looked like this (I hit ctrl-c after servicing the request):
I think this should be a reasonable way for you to take a look at the traffic from the GPS. It should be easy to see how you can change the response back to the client - right now it's just the request being echoed, but you can obviously send anything with
Let me know if you have any further questions about this. Note I used port
50000
- I was guessing it would be available. The way my machine was set up I could not use port 80 (the default html port) but that's mostly a question of firewall configuration etc.