TCP/IP server script
Hello,
I would like to make a TCP/IP server script, which would listen to a port number and save any data it gets. Any ideas? Adnan |
Quote:
|
to make an .sh script to run under linux.
It would listen to a port, and once a connection has been established, saved the messages to a file. sorry for not clarifying my question. |
Quote:
But since you don't say what OS or platform you want to use, what kind of data over what port to listen to, or give any details other than you want to "make a script", not sure what else to tell you. |
You should Google for sample code. Wrox Publishing has a very good book about Linux programming, and they have a very simple client-server development code - they usually have sample code available for download.
You will certainly need some compiled program to act as the server, coded in C/C++ or something similar. I don't doubt that creating a server as a bash script is possible, but it's certainly an awful lot of work and full of ugly hacks, just to do something that is quite easy to do in C/C++. JD Linux Archive |
Try this: http://beej.us/guide/bgnet/
|
You can always take a look at netcat, and do something like
Code:
#!/bin/bash |
All times are GMT -5. The time now is 02:44 AM. |