Programming Forums
User Name Password Register
 

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

Reply
 
Thread Tools Display Modes
Old Jul 13th, 2006, 9:44 AM   #1
ShadowAssasin
Programmer
 
ShadowAssasin's Avatar
 
Join Date: Jun 2006
Location: New York
Posts: 43
Rep Power: 0 ShadowAssasin is on a distinguished road
Raw sockets in python?

Has anyone ever used raw sockets in python?
__________________
It's not complex if you know what you're doing...
ShadowAssasin is offline   Reply With Quote
Old Jul 13th, 2006, 9:57 AM   #2
glimmy
Programmer
 
glimmy's Avatar
 
Join Date: May 2005
Location: Minnesota
Posts: 42
Rep Power: 0 glimmy is on a distinguished road
Send a message via AIM to glimmy
Just import the socket module
if found a link to this tutorial in the python docs at python.org:
http://www.amk.ca/python/howto/sockets/
glimmy is offline   Reply With Quote
Old Jul 13th, 2006, 11:01 AM   #3
ShadowAssasin
Programmer
 
ShadowAssasin's Avatar
 
Join Date: Jun 2006
Location: New York
Posts: 43
Rep Power: 0 ShadowAssasin is on a distinguished road
Thanks, I asked if anyone has used it.
And, thats a tutorial on basic socket usage; it doesn't mention raw sockets.
__________________
It's not complex if you know what you're doing...
ShadowAssasin is offline   Reply With Quote
Old Jul 13th, 2006, 11:41 AM   #4
Arevos
Programming Guru
 
Arevos's Avatar
 
Join Date: Aug 2005
Location: England
Posts: 1,499
Rep Power: 4 Arevos is on a distinguished road
Quote:
Originally Posted by ShadowAssasin
And, thats a tutorial on basic socket usage; it doesn't mention raw sockets.
Same thing. It's practically a direct mapping to the standard socket functions in C, so it's about as raw as one can achieve.

I've programmed sockets in C before, though I haven't really touched them in Python. It's usually easier to use a prewritten library or networking framework.
Arevos is offline   Reply With Quote
Old Jul 13th, 2006, 12:20 PM   #5
Sane
Programming Guru
 
Sane's Avatar
 
Join Date: Apr 2005
Posts: 1,799
Rep Power: 5 Sane will become famous soon enough
Just search for some posts in this forum by me. I've posted up several things that use sockets.

This includes an FTP client, an FTP server, an HTTP server, and I believe, I may have posted an HTTP client and file client/server here as well.
Sane is offline   Reply With Quote
Old Jul 13th, 2006, 2:59 PM   #6
Dameon
Troll
 
Dameon's Avatar
 
Join Date: Apr 2005
Location: Texas
Posts: 732
Rep Power: 4 Dameon is on a distinguished road
SOCK_RAW constant for the type parameter to the socket() call. It seems to be almost identical to the ever-so-popular Berkley Socket API. Note that raw sockets will likely require special permissions/not be available on all platforms.
__________________
MD5(sig) = bcef75433db02e9ad9bf81d6f7c5c270
Dameon is offline   Reply With Quote
Old Aug 25th, 2006, 2:29 PM   #7
GoldenArms
Newbie
 
Join Date: Jul 2006
Posts: 8
Rep Power: 0 GoldenArms is on a distinguished road
While using a socket, how can I recieve all the output generated by a host Im communicating with without having to specify the amount af bytes to read? (like socket.recieve(1024)) python has a good telnet module that has a function called "read_until()" which reads the output until a specified character is read and stops. This isn't too reliable because the character might not be there in the event something unexpected happens. Anyone know how I can just read all of the output?
(oh i also tried a "while buffer >= 1" loop but it just hung )
GoldenArms is offline   Reply With Quote
Old Aug 25th, 2006, 3:28 PM   #8
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
Probably best to start a new thread, rather than hijack another.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei 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

Similar Threads
Thread Thread Starter Forum Replies Last Post
[tutorial] Python for programming beginners coldDeath Python 30 Dec 14th, 2005 11:35 AM
Threads | Sockets in Python Infinite Recursion Python 14 Oct 4th, 2005 1:59 PM
Advanced Python Tricks Arevos Python 19 Sep 24th, 2005 7:39 AM
Python - A Programmers Introduction coldDeath Python 17 Aug 19th, 2005 12:41 PM
Python, GUI and sockets. beichu Python 2 Aug 8th, 2005 1:50 PM




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

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