473,385 Members | 1,645 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

trying to use SOCK_RAW yields error "

I am trying to create raw socket:

server = socket.socket(socket.AF_INET, socket.SOCK_RAW,
socket.getprotobyname('ip'))

As a result I get the following error:

Traceback (most recent call last):
File "tcpsrv.py", line 14, in <module>
server = socket.socket(socket.AF_INET, socket.SOCK_RAW,
socket.getprotobyname('ip'))
File "/usr/lib/python2.5/socket.py", line 154, in __init__
_sock = _realsocket(family, type, proto)
socket.error: (93, 'Protocol not supported')
Does anybody have used socket.SOCK_RAW in the past?
Aug 12 '08 #1
3 6037
Dnia Tue, 12 Aug 2008 05:40:36 -0700 (PDT), Tzury Bar Yochay napisa³(a):

Hi,
server = socket.socket(socket.AF_INET, socket.SOCK_RAW,
socket.getprotobyname('ip'))
....
Does anybody have used socket.SOCK_RAW in the past?
When using SOCK_RAW, the family should be AF_PACKET,
not AF_INET. Note that you need root privileges to do so.

--
Regards,
Wojtek Walczak,
http://www.stud.umk.pl/~wojtekwa/
Aug 12 '08 #2
When using SOCK_RAW, the family should be AF_PACKET,
not AF_INET. Note that you need root privileges to do so.
I changed as instructed:
server = socket.socket(socket.AF_PACKET, socket.SOCK_RAW,
socket.getprotobyname('ip'))

now I am getting:

Traceback (most recent call last):
File "tcpsrv.py", line 15, in <module>
server.bind((host,port))
File "<string>", line 1, in bind
socket.error: (19, 'No such device')

Aug 12 '08 #3
Dnia Tue, 12 Aug 2008 07:21:15 -0700 (PDT), Tzury Bar Yochay napisa³(a):
I changed as instructed:
server = socket.socket(socket.AF_PACKET, socket.SOCK_RAW,
socket.getprotobyname('ip'))

now I am getting:

Traceback (most recent call last):
File "tcpsrv.py", line 15, in <module>
server.bind((host,port))
File "<string>", line 1, in bind
socket.error: (19, 'No such device')
What's the value of host variable? AFAIR it should be the name
of the interface you want to bind to ('eth0', 'ppp0', whatever).
--
Regards,
Wojtek Walczak,
http://www.stud.umk.pl/~wojtekwa/
Aug 12 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Alan Silver | last post by:
Hello, I have an ASP that takes a connection string and SQL statement in the querystring and is supposed to return the XML representation of the recordset to the Response stream (don't worry,...
8
by: Rich Grise | last post by:
I think I've finally found a tutorial that can get me started: http://www.zib.de/Visual/people/mueller/Course/Tutorial/tutorial.html and I've been lurking for awhile as well. What happened is,...
11
by: MLH | last post by:
If this is what MySQL is set to... SELECT DISTINCTROW qryVehiclesNowners5.SerialNum, qryVehiclesNowners5.VDescr, qryVehiclesNowners5.Owner, qryVehiclesNowners5.VehicleJobID ,...
11
by: MLH | last post by:
I copied the following code snippet from A97 HELP. Am getting an error at compile time suggesting there's a problem with the first line (compile error, user-defined type not defined). It is likely...
1
by: Matthew Louden | last post by:
When I created ASP.NET application, I tried both VB.NET and C#: Build | Rebuild Project is ok But Debug | Start yields the following error dialog: Error while trying to run project: unable to...
42
by: Martin Jørgensen | last post by:
Hi, I'm trying to move a matlab program into c language. For those who knows matlab, this is the line I want to program in c: hx(1:nx,1:ny) = 0; % nx=10, ny=10 It works on a 2-dimensional...
0
by: viktough | last post by:
i am trying to include a new Address family (PF_CAN) in the extension module of socket - socketmodule.c... At first i am just trying to create a socket. When I use s=socket.socket(socket.AF_INET,...
3
by: beachlounger | last post by:
Using C++ language to complete this homework 1. Develop class Polynomial. The internal representation of a Polynomial is an array of terms. Each term contains a coefficient and an exponent. The...
2
by: Dennis Zickefoose | last post by:
The following code yields error CS0131: "The left-hand side of an assignment must be a variable, property or indexer": (new int())++; However, when using a class with a custom operator++, an...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.