![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
Join Date: Sep 2005
Posts: 2
Rep Power: 0
![]() |
Need examples of Network programming using /dev/tcp and /dev/udp
Hi,
I have used the /dev/tcp/hostip/port constructs in bash to get banner strings from servers and such but have not found a good way to do two-way communication. This is pretty easy to implement in other languages like TCL but I have not found a way to do it in bash. What I want is to the be able to "echo" things into a socket and be able to "read" things from a socket. I'm sure it can all be done with file descriptor handling but I can't come up with the proper syntax. Thanks. |
|
|
|
|
|
#2 |
|
Newbie
Join Date: Sep 2005
Posts: 2
Rep Power: 0
![]() |
Kinda lame to reply to my own post but this always happens to me. I search a bunch of time for an answer, post requesting some help, keep searching and then find the answer. I post it here so that anyone searching here will find it:
from: http://advbash.activeventure.net/devref1.html relevant example: bash$ exec 5<>/dev/tcp/www.slashdot.org/80 bash$ echo -e "GET / HTTP/1.0\n" >&5 bash$ cat <&5 |
|
|
|
|
|
#3 |
|
Programming Guru
![]() ![]() ![]() |
Thanks for letting us know of the solution.
__________________
http://jasonpowers.net "There are a thousand hacking at the branches of evil to one who is striking at the root." |
|
|
|
|
|
#4 |
|
Professional Programmer
Join Date: Apr 2005
Location: London, England
Posts: 459
Rep Power: 4
![]() |
Well, be a little careful with that. It's not available on Debian-based systems' BASH builds. You should probably be using netcat.
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|