Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Sep 7th, 2005, 11:30 AM   #1
Ed Toro
Newbie
 
Join Date: Sep 2005
Posts: 2
Rep Power: 0 Ed Toro is on a distinguished road
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.
Ed Toro is offline   Reply With Quote
Old Sep 7th, 2005, 12:47 PM   #2
Ed Toro
Newbie
 
Join Date: Sep 2005
Posts: 2
Rep Power: 0 Ed Toro is on a distinguished road
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
Ed Toro is offline   Reply With Quote
Old Sep 7th, 2005, 12:56 PM   #3
Infinite Recursion
Programming Guru
 
Infinite Recursion's Avatar
 
Join Date: Jul 2004
Location: United States
Posts: 3,467
Rep Power: 8 Infinite Recursion is on a distinguished road
Send a message via MSN to Infinite Recursion Send a message via Yahoo to Infinite Recursion
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."
Infinite Recursion is offline   Reply With Quote
Old Sep 7th, 2005, 4:09 PM   #4
Cerulean
Professional Programmer
 
Cerulean's Avatar
 
Join Date: Apr 2005
Location: London, England
Posts: 459
Rep Power: 4 Cerulean is on a distinguished road
Well, be a little careful with that. It's not available on Debian-based systems' BASH builds. You should probably be using netcat.
Cerulean is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 5:23 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC