Skip to content

Commit 06846fd

Browse files
committed
Drop Python3 compatibility and in wait for a new to_bytes function
1 parent c0d0fde commit 06846fd

3 files changed

Lines changed: 6 additions & 6 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ This allows you to create a custom made Ethernet/WiFi communication system which
99
Python versions tested:
1010

1111
- [x] 2.7.x
12-
- [x] 3.5.x
12+
- [ ] 3.5.x - Reimplement to_bytes for Socket.send
1313

1414
OSes:
1515

rawsocketpy/packet.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# -*- coding: utf-8 -*-
33

44
from __future__ import absolute_import
5-
from .util import to_str, to_bytes
5+
from .util import to_str
66

77
class RawPacket():
88
"""RawPacket is the resulting data container of the RawSocket class.

rawsocketpy/socket.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def __init__(self, interface, protocol, sock=None, no_recv_protocol=False):
2525
:param no_recv_protocol: If true (default False), the socket will not subscribe to anything, recv will just block.
2626
:type no_recv_protocol: bool
2727
"""
28-
if not 1536 < protocol < 0xFFFF:
28+
if not protocol < 0xFFFF:
2929
raise ValueError("Protocol has to be in the range 0 to 65535")
3030
self.no_recv_protocol = no_recv_protocol
3131
self.non_processed_protocol = protocol
@@ -37,7 +37,7 @@ def __init__(self, interface, protocol, sock=None, no_recv_protocol=False):
3737
:type: str/bytes/bytearray"""
3838
if no_recv_protocol:
3939
self.sock = self.sock_create(self.interface, 0, sock)
40-
else:
40+
else:
4141
self.sock = self.sock_create(self.interface, self.protocol, sock)
4242
self.close = self.sock.close
4343

@@ -65,7 +65,7 @@ def send(self, msg, dest=None, ethertype=None):
6565
"""
6666
if ethertype is None: ethertype = self.ethertype
6767
if dest is None: dest = self.BROADCAST
68-
payload = (to_bytes(dest) + self.mac + to_bytes(ethertype) + to_bytes(msg))
68+
payload = dest + self.mac + ethertype + msg
6969
self.sock.send(payload)
7070

7171
def recv(self):
@@ -75,7 +75,7 @@ def recv(self):
7575
7676
:rtype: RawPacket
7777
"""
78-
data = self.sock.recv(1500)
78+
data = self.sock.recv(1024)
7979
return RawPacket(data)
8080

8181
def __str__(self):

0 commit comments

Comments
 (0)