;ò
.‹Ú>c           @   s&   d  Z  d k Z d f  d „  ƒ  YZ d S(   sğ   wtConnection.py
 
 author michael branton

 This script is free software; you can redistribute it and/or
 modify it under the terms of the GNU Lesser General Public
 License as published by the Free Software Foundation; either
 version 2.1 of the License, or (at your option) any later version.

 This library is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 Lesser General Public License for more details.

 You should have received a copy of the GNU Lesser General Public
 License along with this script; if not, write to the Free Software
 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
Ns   wtConnectionc           B   sq   t  Z d  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z	 d „  Z
 d	 „  Z d
 „  Z d „  Z RS(   sa   encapulates basic socket methods needed to talk to a
	wireTAP server (http://wiretap.stetson.edu)c         G   ss   d |  _ |  i d ƒ |  i d ƒ |  i d ƒ |  i ƒ  t | ƒ d j o |  i | d ƒ n |  i d ƒ d S(   s—    Class constructor. Initializes a socket connection
		using a given port. If no port is specified, one is 
		chosen at random. Defaults to RAW protocols   Falses    i    N(	   s   selfs
   sockexistss   setHosts   setHostPorts   setProtocols   blocks   lens   ports   setClientPort(   s   selfs   port(    (    s3   /home/delire/devel/python/pyKit-OSC/wtConnection.pys   __init__   s     	
c         C   sç   |  i d j o |  i i ƒ  n |  i d j o t i t i t i ƒ |  _ nK |  i d j o t i t i t i ƒ |  _ n t i t i t i	 ƒ |  _ |  i
 d j o |  i i d |  i
 f ƒ n |  i i |  i ƒ d |  _ d S(   s   private method s   Trues   UDPs   TCPi    s    N(   s   selfs
   sockexistss   ss   closes   prots   sockets   AF_INETs
   SOCK_DGRAMs   SOCK_STREAMs   SOCK_RAWs   cports   binds   setblockings   blocking(   s   self(    (    s3   /home/delire/devel/python/pyKit-OSC/wtConnection.pys   create-   s     c         C   s5   | |  _  |  i d j o |  i ƒ  |  i ƒ  n d S(   sI    supported protocols are 'UDP', 'TCP' and 'RAW'. 'RAW' is 
		the default.s   TrueN(   s   prots   selfs
   sockexistss   closes   create(   s   selfs   prot(    (    s3   /home/delire/devel/python/pyKit-OSC/wtConnection.pys   setProtocol@   s
     	
c         C   s   | |  _  d S(   s    set host to communicate withN(   s   hosts   self(   s   selfs   host(    (    s3   /home/delire/devel/python/pyKit-OSC/wtConnection.pys   setHostL   s     c         C   s   | |  _ d S(   s(    set port on host to use for connection N(   s   ports   selfs   hport(   s   selfs   port(    (    s3   /home/delire/devel/python/pyKit-OSC/wtConnection.pys   setHostPortR   s     c         C   s5   | |  _ |  i d j o |  i ƒ  |  i ƒ  n d S(   s*    set port on client to use for connection s   TrueN(   s   ports   selfs   cports
   sockexistss   closes   create(   s   selfs   port(    (    s3   /home/delire/devel/python/pyKit-OSC/wtConnection.pys   setClientPortX   s
     	
c         C   s7   |  i d j o# |  i i | |  i |  i f ƒ n d S(   s   send data out to  hosts    N(   s   selfs   hosts   ss   sendtos   messages   hport(   s   selfs   message(    (    s3   /home/delire/devel/python/pyKit-OSC/wtConnection.pys   sendb   s     c         C   s   |  i i d ƒ } | Sd S(   s   get data backi   N(   s   selfs   ss   recvfroms   result(   s   selfs   result(    (    s3   /home/delire/devel/python/pyKit-OSC/wtConnection.pys   receivei   s     c         C   s   |  i i ƒ  } | Sd S(   sW   end it all by closing the socket connection. Returns
		status of attempted socket closeN(   s   selfs   ss   closes   result(   s   selfs   result(    (    s3   /home/delire/devel/python/pyKit-OSC/wtConnection.pys   closep   s     c         C   s   d |  _ d S(   s   set socket to blockingi   N(   s   selfs   blocking(   s   self(    (    s3   /home/delire/devel/python/pyKit-OSC/wtConnection.pys   blockx   s     c         C   s   d |  _ d S(   s   set socket to non-blockingi    N(   s   selfs   blocking(   s   self(    (    s3   /home/delire/devel/python/pyKit-OSC/wtConnection.pys   nonblock}   s     (   s   __name__s
   __module__s   __doc__s   __init__s   creates   setProtocols   setHosts   setHostPorts   setClientPorts   sends   receives   closes   blocks   nonblock(    (    (    s3   /home/delire/devel/python/pyKit-OSC/wtConnection.pys   wtConnection   s    						
				(   s   __doc__s   sockets   wtConnection(   s   sockets   wtConnection(    (    s3   /home/delire/devel/python/pyKit-OSC/wtConnection.pys   ?   s   	