<commit_before># Filename: sockets.py
# Module:	sockets
# Date:		04th August 2004
# Author:	<NAME> <<EMAIL>>

"""TCP/IP and UDP Sockets

This module contains classes for TCP/IP and UDP sockets for
both servers and clients. All classes are thin layers on-top
of the standard socket library. All implementations are
non-blocking. This module relies heavily on the event module
and as such the implementations in this module are all
event-driven and should be sub-classed to do something usefull.
"""

import re
import time
import errno
import socket
from cStringIO import StringIO

try:
	import select26 as select
except ImportError:
	import select

from circuits import listener, Event, Component

POLL_INTERVAL = 0.00001
CONNECT_TIMEOUT = 4
BUFFER_SIZE = 131072
BACKLOG = 512

###
### Events
###

class Error(Event): pass
class Connect(Event): pass
class Disconnect(Event): pass
class Read(Event): pass
class Write(Event): pass
class Close(Event): pass

class Client(Component):

	host = ""
	port = 0
	ssl = False
	server = {}<commit_msg>lib.sockets: Documented events<commit_after># Filename: sockets.py
# Module:	sockets
# Date:		04th August 2004
# Author:	<NAME> <<EMAIL>>

"""TCP/IP and UDP Sockets

This module contains classes for TCP/IP and UDP sockets for
both servers and clients. All classes are thin layers on-top
of the standard socket library. All implementations are
non-blocking. This module relies heavily on the event module
and as such the implementations in this module are all
event-driven and should be sub-classed to do something usefull.
"""

import re
import time
import errno
import socket
from cStringIO import StringIO

try:
	import select26 as select
except ImportError:
	import select

from circuits import listener, Event, Component

POLL_INTERVAL = 0.00001
CONNECT_TIMEOUT = 4
BUFFER_SIZE = 131072
BACKLOG = 512

###
### Events
###

class Connect(Event):
	"""Connect(Event) -> Connect Event

   if Client:
      args: host, port

   if Server:
      args: sock, host, port
   """

class Disconnect(Event):
	"""Disconnect(Event) -> Disconnect Event

   if Client, no args.

   If Server:
      args: sock
   """

class Read(Event):
	"""Read(Event) -> Read Event

   if Client:
      args: data

   If Server:
      args: sock, data

   if UDP Client or Server:
      args: address, data
   """

class Write(Event):
	"""Write(Event) -> Write Event

   If Client:
      args: data

   if Server:
      args: sock, data

   if UDP Client or Server:
      args: address, data
	"""

class Error(Event):
	"""Error(Event) -> Error Event

   if Client: error

   if Server: sock, error
   """

class Close(Event):
	"""Close(Event) -> Close Event

   If Client, no args.

   if Server:
      args: sock
	"""

class Client(Component):

	host = ""
	port = 0
	ssl = False
	server = {}
{'fraction_non_alphanumeric': 0.09207708779443255, 'fraction_numerical': 0.017844396859386154, 'mean_word_length': 3.648424543946932, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5412671', 'n_tokens_mistral': 905, 'n_tokens_neox': 832, 'n_words': 350}