Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5510dc2

Browse files
committed
socket.py
1 parent 50d5e8a commit 5510dc2

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

Mac/Unsupported/mactcp/socket.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828
# Internal constants
2929

30-
_BUFSIZE = 4096 # Size of TCP/UDP input buffer
30+
_BUFSIZE = 15*1024 # Size of TCP/UDP input buffer
3131

3232
_myaddress = None
3333
_myname = None
@@ -74,21 +74,21 @@ def _gethostaddress():
7474

7575
def socket(family, type, *which):
7676
if family <> AF_INET:
77-
raise my_error, 'Protocol family %d not supported' % type
77+
raise _myerror, 'Protocol family %d not supported' % type
7878
if type == SOCK_DGRAM:
7979
return _udpsocket()
8080
elif type == SOCK_STREAM:
8181
return _tcpsocket()
82-
raise my_error, 'Protocol type %d not supported' % type
82+
raise _myerror, 'Protocol type %d not supported' % type
8383

8484

8585
def fromfd(*args):
86-
raise my_error, 'Operation not supported on a mac'
86+
raise _myerror, 'Operation not supported on a mac'
8787

8888

8989
class _socket:
9090
def unsupported(self, *args):
91-
raise my_error, 'Operation not supported on this socket'
91+
raise _myerror, 'Operation not supported on this socket'
9292

9393
accept = unsupported
9494
bind = unsupported
@@ -121,7 +121,7 @@ def __init__(self):
121121

122122
def accept(self):
123123
if not self.listening:
124-
raise my_error, 'Not listening'
124+
raise _myerror, 'Not listening'
125125
self.listening = 0
126126
self.stream.wait()
127127
self.accepted = 1
@@ -169,7 +169,7 @@ def makefile(self, rw = 'r'):
169169

170170
def recv(self, bufsize, flags=0):
171171
if flags:
172-
raise my_error, 'recv flags not yet supported on mac'
172+
raise _myerror, 'recv flags not yet supported on mac'
173173
if not self.databuf:
174174
try:
175175
self.databuf, urg, mark = self.stream.Rcv(0)
@@ -207,7 +207,7 @@ def __init__(self):
207207
class _socketfile:
208208

209209
def __init__(self, sock, rw):
210-
if rw not in ('r', 'w'): raise ValueError, "mode must be 'r' or 'w'"
210+
if rw not in ('r', 'w'): raise _myerror, "mode must be 'r' or 'w'"
211211
self.sock = sock
212212
self.rw = rw
213213
self.buf = ''

0 commit comments

Comments
 (0)