Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Raw Socket Error
#1
I am getting an "socket.error: [Errno 22] Invalid argument" error when calling sendto below. I made this simple version based on https://www.binarytides.com/raw-socket-p...hon-linux/. My google-fu has failed me. Any guesses as to what is wrong with the sendto call?

import socket, sys
from struct import *

try:
    s = socket.socket(socket.AF_INET, socket.SOCK_RAW, socket.IPPROTO_RAW)
except socket.error, msg:
    print 'Socket could not be created. Error Code : ' + str(msg[0]) + ' Message ' + msg[1]
    sys.exit()
    
packet='active=1'
dest_ip = '192.168.1.10'

s.sendto(packet, (dest_ip, 7))
Larz60+ wrote Sep-26-2019, 12:55 AM:
Please post all code, output and errors (in it's entirety) between their respective tags. I did it for you this time, Here are instructions on how to do it yourself next time.
Quote
#2
check with simple..socket program
Quote

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  socket.error Karin 0 41 Nov-11-2019, 08:53 AM
Last Post: Karin
  socket programming ConnectionRefusedError error srm 3 747 May-16-2019, 08:07 PM
Last Post: LavaCreeperKing
  Python socket : Error receive data quanglnh1993 1 3,658 Mar-14-2018, 11:59 AM
Last Post: avorane

Forum Jump:


Users browsing this thread: 1 Guest(s)