Python Forum
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))
Reply
#2
check with simple..socket program
Reply


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

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020