![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Programmer
Join Date: Jun 2006
Location: New York
Posts: 43
Rep Power: 0
![]() |
Raw sockets in python?
Has anyone ever used raw sockets in python?
__________________
It's not complex if you know what you're doing... |
|
|
|
|
|
#2 |
|
Programmer
|
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/ |
|
|
|
|
|
#3 |
|
Programmer
Join Date: Jun 2006
Location: New York
Posts: 43
Rep Power: 0
![]() |
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... |
|
|
|
|
|
#4 | |
|
Programming Guru
![]() Join Date: Aug 2005
Location: England
Posts: 1,499
Rep Power: 5
![]() |
Quote:
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. |
|
|
|
|
|
|
#5 |
|
Programming Guru
![]() |
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. |
|
|
|
|
|
#6 |
|
Troll
Join Date: Apr 2005
Location: Texas
Posts: 732
Rep Power: 4
![]() |
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 |
|
|
|
|
|
#7 |
|
Newbie
Join Date: Jul 2006
Posts: 8
Rep Power: 0
![]() |
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 ) |
|
|
|
|
|
#8 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
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 |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
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 |