PageRenderTime 307ms queryTime 58ms sortTime 13ms getByIdsTime 47ms findMatchingLines 41ms

100+ results results for 'socket repo:devin-c/protobuf' (307 ms)

Not the results you expected?
netmsg.bas http://segin-utils.googlecode.com/svn/trunk/ | Basic | 577 lines
                    
84'
                    
85' Linux does NOT need socket library inits, unlike Windows...
                    
86'
                    
122function hOpen( byval proto as integer = IPPROTO_TCP ) as SOCKET export
                    
123	dim s as SOCKET
                    
124    
                    
153	
                    
154	function = bind( s, cast( PSOCKADDR, @sa ), len( sa ) ) <> SOCKET_ERROR
                    
155	
                    
160	
                    
161	function = listen( s, timeout ) <> SOCKET_ERROR
                    
162	
                    
165'':::::
                    
166function hAccept( byval s as SOCKET, byval sa as sockaddr_in ptr ) as SOCKET export
                    
167	dim salen as integer 
                    
                
SocketStream.cc https://freespeech.svn.sourceforge.net/svnroot/freespeech | C++ | 558 lines
                    
280  if((m_listen_socket = socket(PF_INET, SOCK_STREAM, 0)) == -1) {
                    
281    perror("network_socket::init_tcp_stream : call to socket() failed; socket not created.");
                    
282    throw new GeneralException("network_socket::init_tcp_stream : socket not created.",__FILE__,__LINE__);
                    
324	
                    
325	throw new GeneralException("network_socket::init_tcp_stream : could not set flags (O_NONBLOCK) of the socket."
                    
326				 ,__FILE__,__LINE__);   
                    
333 
                    
334  if(setsockopt(m_listen_socket, SOL_SOCKET, SO_REUSEADDR, (const char*)&one, sizeof(one))) {
                    
335    
                    
356
                    
357    perror ("network_socket::init_tcp_stream : bind() failed; socket not created.");
                    
358    shutdown();
                    
446  if((m_write_socket = socket(PF_INET, SOCK_STREAM, 0)) < 0) {
                    
447    perror("network_socket::connect(): socket() failed");
                    
448    throw new GeneralException("network_socket::connect connect() failed",__FILE__,__LINE__);
                    
                
stub_dev.c http://wl500g.googlecode.com/svn/trunk/ | C | 544 lines
                    
87	int sockfd = 0;
                    
88	struct socket *socket;
                    
89
                    
107
                    
108		socket = sockfd_to_socket(sockfd);
                    
109		if (!socket) {
                    
112		}
                    
113		sdev->ud.tcp_socket = socket;
                    
114
                    
186	if (ud->tcp_socket) {
                    
187		dev_dbg(&sdev->udev->dev, "shutdown tcp_socket %p\n",
                    
188			ud->tcp_socket);
                    
188			ud->tcp_socket);
                    
189		ud->tcp_socket->ops->shutdown(ud->tcp_socket, SEND_SHUTDOWN|RCV_SHUTDOWN);
                    
190	}
                    
                
DefaultHostnameVerifier.SSLSocketFactory.html http://vt-middleware.googlecode.com/svn/ | HTML | 142 lines
                    
7<TITLE>
                    
8Uses of Class edu.vt.middleware.ldap.ssl.DefaultHostnameVerifier.SSLSocketFactory (VT LDAP Libraries 3.3.5 API)
                    
9</TITLE>
                    
16{
                    
17    parent.document.title="Uses of Class edu.vt.middleware.ldap.ssl.DefaultHostnameVerifier.SSLSocketFactory (VT LDAP Libraries 3.3.5 API)";
                    
18}
                    
38  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
                    
39  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../../../edu/vt/middleware/ldap/ssl/DefaultHostnameVerifier.SSLSocketFactory.html" title="class in edu.vt.middleware.ldap.ssl"><FONT CLASS="NavBarFont1"><B>Class</B></FONT></A>&nbsp;</TD>
                    
40  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Use</B></FONT>&nbsp;</TD>
                    
57<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
                    
58  <A HREF="../../../../../../index.html?edu/vt/middleware/ldap/ssl/class-use/DefaultHostnameVerifier.SSLSocketFactory.html" target="_top"><B>FRAMES</B></A>  &nbsp;
                    
59&nbsp;<A HREF="DefaultHostnameVerifier.SSLSocketFactory.html" target="_top"><B>NO FRAMES</B></A>  &nbsp;
                    
80<H2>
                    
81<B>Uses of Class<br>edu.vt.middleware.ldap.ssl.DefaultHostnameVerifier.SSLSocketFactory</B></H2>
                    
82</CENTER>
                    
                
TLSSocketFactoryTest.java http://vt-middleware.googlecode.com/svn/ | Java | 209 lines
                    
120    final TLSSocketFactory sf =
                    
121      (TLSSocketFactory) ldap.getLdapConfig().getSslSocketFactory();
                    
122
                    
148    AssertJUnit.assertEquals(
                    
149      Arrays.asList(((SSLSocket) sf.createSocket()).getEnabledCipherSuites()),
                    
150      Arrays.asList(CIPHERS));
                    
161    final TLSSocketFactory sf =
                    
162      (TLSSocketFactory) ldap.getLdapConfig().getSslSocketFactory();
                    
163
                    
169    AssertJUnit.assertNotSame(
                    
170      Arrays.asList(((SSLSocket) sf.createSocket()).getEnabledProtocols()),
                    
171      Arrays.asList(PROTOCOLS));
                    
203    AssertJUnit.assertEquals(
                    
204      Arrays.asList(((SSLSocket) sf.createSocket()).getEnabledProtocols()),
                    
205      Arrays.asList(PROTOCOLS));
                    
                
Server.vala http://libzee.googlecode.com/svn/trunk/ | Vala | 215 lines
                    
55		 */
                    
56		protected InetSocketAddress					 _address;
                    
57		/**
                    
57		/**
                    
58		 * Server's socket service
                    
59		 */
                    
59		 */
                    
60		protected ThreadedSocketService  			 _service;
                    
61		
                    
90			
                    
91			this._address = new InetSocketAddress(addr, port);
                    
92			this._max_threads = max_threads;
                    
135			// [TODO]: Wrap the generic GLib error
                    
136			this._service.add_address(this._address, SocketType.STREAM, SocketProtocol.TCP, null, null);
                    
137			
                    
                
myleftchatluadb.as http://as3chat.googlecode.com/svn/trunk/ | ActionScript | 430 lines
                    
33	{
                    
34		private var socket:SocketConnection;
                    
35		private var host:String = 'myleft.org';
                    
193			
                    
194			socket = new SocketConnection;
                    
195			socket.addEventListener(Define.CONNECT, eventHandle);
                    
333		{
                    
334			if (!socket.socket.connected) {
                    
335				progressDialog.setTitle('???...');
                    
405		{
                    
406			if (socket.socket.connected) socket.send('<quit/>');
                    
407		}
                    
414			}
                    
415			else if (socket.socket.connected && messageText.getText().length>0) 
                    
416			{
                    
                
nonroot.html https://code.google.com/p/bugzilla4intranet/ | HTML | 745 lines
                    
188datadir=/home/foo/mymysql
                    
189socket=/home/foo/mymysql/thesock
                    
190port=8081
                    
192[mysql]
                    
193socket=/home/foo/mymysql/thesock
                    
194port=8081
                    
                
NioServer.java http://wastelanders.googlecode.com/svn/trunk/ | Java | 396 lines
                    
90     */
                    
91    private Map<SocketChannel, List<ByteBuffer>> pendingData = new HashMap<SocketChannel, List<ByteBuffer>>();
                    
92
                    
279        // channel.
                    
280        ServerSocketChannel serverSocketChannel = (ServerSocketChannel) key.channel();
                    
281
                    
282        // Accept the connection and make it non-blocking
                    
283        SocketChannel socketChannel = serverSocketChannel.accept();
                    
284        socketChannel.configureBlocking(false);
                    
293    private void read(SelectionKey key) {
                    
294        SocketChannel socketChannel = (SocketChannel) key.channel();
                    
295
                    
328    private void write(SelectionKey key) {
                    
329        SocketChannel socketChannel = (SocketChannel) key.channel();
                    
330
                    
                
cluster.go https://code.google.com/p/camlistore/ | Go | 482 lines
                    
132
                    
133	socket, err := server.AcquireSocket()
                    
134	if err != nil {
                    
134	if err != nil {
                    
135		log("SYNC Failed to get socket to ", addr, ": ", err.Error())
                    
136		return
                    
138
                    
139	// Monotonic will let us talk to a slave and still hold the socket.
                    
140	session := newSession(Monotonic, cluster, socket, 10 * time.Second)
                    
412
                    
413// AcquireSocket returns a socket to a server in the cluster.  If slaveOk is
                    
414// true, it will attempt to return a socket to a slave server.  If it is
                    
415// false, the socket will necessarily be to a master server.
                    
416func (cluster *mongoCluster) AcquireSocket(slaveOk bool, syncTimeout time.Duration) (s *mongoSocket, err error) {
                    
417	started := time.Now()
                    
                
xpc_partition.c git://github.com/torvalds/linux.git | C | 534 lines
                    
146	}
                    
147	rp = (struct xpc_rsvd_page *)__va(xp_socket_pa(rp_pa));
                    
148
                    
                
id.po.in git://git.savannah.gnu.org/gsasl.git | Autoconf | 249 lines
                    
50#, c-format
                    
51msgid "Cannot initialize Windows sockets."
                    
52msgstr "Tidak dapat menginisialisasi soket Windows."
                    
                
HTUtils.h git://github.com/alandipert/ncsa-mosaic.git | C Header | 268 lines
                    
210#define HT_REDIRECTING 29998
                    
211#define HT_LOADED 29999                 /* Instead of a socket */
                    
212#define HT_INTERRUPTED -29998
                    
                
HTTPURLLoader.as http://crossxhr.googlecode.com/svn/trunk/ | ActionScript | 197 lines
                    
28		
                    
29		private var socket:Socket;
                    
30		private var headerComplete:Boolean = false;
                    
48					
                    
49			socket = new Socket();
                    
50
                    
52			socket.addEventListener( "close" , onCloseEvent , false, 0 );
                    
53			socket.addEventListener( "ioError" , onIOErrorEvent , false, 0 );
                    
54			socket.addEventListener( "securityError" , onSecurityErrorEvent , false, 0 );
                    
54			socket.addEventListener( "securityError" , onSecurityErrorEvent , false, 0 );
                    
55			socket.addEventListener( "socketData" , onSocketDataEvent , false , 0 );
                    
56		}
                    
109			var str:String = "";
                    
110			try { str = socket.readUTFBytes(socket.bytesAvailable); } catch(e:Error) { }
                    
111			if(!headerComplete) {
                    
                
eX_setup.h git://git.savannah.nongnu.org/exosip.git | C Header | 377 lines
                    
121#define EXOSIP_OPT_DNS_CAPABILITIES (EXOSIP_OPT_BASE_OPTION+14) /**< int *: 0 to disable, 2 to use NAPTR/SRV record */
                    
122#define EXOSIP_OPT_SET_DSCP (EXOSIP_OPT_BASE_OPTION+15) /**< int *: set a dscp value for SIP socket */
                    
123#define EXOSIP_OPT_REGISTER_WITH_DATE (EXOSIP_OPT_BASE_OPTION+16) /**< int *: enable usage of Date header in REGISTER */
                    
238/**
                    
239 * Listen on a specified socket.
                    
240 * 
                    
250/**
                    
251 * Reset transport sockets.
                    
252 * 
                    
262 * @param transport IPPROTO_UDP for udp. (soon to come: TCP/TLS?)
                    
263 * @param socket socket to use for listening to UDP sip messages.
                    
264 * @param port the listening port for masquerading.
                    
265 */
                    
266  int eXosip_set_socket (struct eXosip_t *excontext, int transport, int socket, int port);
                    
267
                    
                
IrServerApplet.lua http://irserversb.googlecode.com/svn/trunk/ | Lua | 523 lines
                    
67
                    
68local socket = require("socket")
                    
69local os = require("os")
                    
291	-- load namespace
                    
292	-- create a TCP socket and bind it to the local host, at any port
                    
293	server = socket.bind("*", 8174)
                    
                
openssl_stream_service.hpp http://openqwaq.googlecode.com/svn/trunk/ | C++ Header | 532 lines
                    
164
                    
165  // Construct a new stream socket service for the specified io_service.
                    
166  explicit openssl_stream_service(asio::io_service& io_service)
                    
                
overview-summary.html http://j-sim.googlecode.com/svn/trunk/ | HTML | 318 lines
                    
191<TR BGCOLOR="white" CLASS="TableRowColor">
                    
192<TD WIDTH="20%"><B><A HREF="drcl/inet/socket/package-summary.html">drcl.inet.socket</A></B></TD>
                    
193<TD>&nbsp;</TD>
                    
                
Program.cs https://code.google.com/p/prjtest00/ | C# | 352 lines
                    
56            //console.
                    
57            Socket NewSocket = listener.EndAcceptSocket(Result);
                    
58
                    
74        {
                    
75            Socket ClientSocket = (Socket)Result.AsyncState;
                    
76            try
                    
84                Console.WriteLine("[{0}][Receive Message]: {1}", (int)ClientSocket.Handle, Encoding.ASCII.GetString(_RecvBuff, 0, RecvSize));
                    
85                ClientSocket.BeginReceive(_RecvBuff, 0, _RecvBuff.Length, SocketFlags.None, new AsyncCallback(DoReceiveCallback), ClientSocket);
                    
86            }
                    
192        //    {
                    
193        //        Socket NewSocket = Listener.AcceptSocket();
                    
194        //        if (NewSocket.Connected)
                    
256            //AcceptThread.Start(Listener);
                    
257//            Socket mySocket = myTcpListener.AcceptSocket();
                    
258            //do
                    
                
SocketReactor.h http://mingw-lib.googlecode.com/svn/trunk/ | C++ Header | 239 lines
                    
88	/// Once started, the SocketReactor waits for events
                    
89	/// on the registered sockets, using Socket::select().
                    
90	/// If an event is detected, the corresponding event handler
                    
106	///
                    
107	/// If there are no sockets for the SocketReactor to pass to
                    
108	/// Socket::select(), an IdleNotification will be dispatched to
                    
164
                    
165	void addEventHandler(const Socket& socket, const Poco::AbstractObserver& observer);
                    
166		/// Registers an event handler with the SocketReactor.
                    
171
                    
172	void removeEventHandler(const Socket& socket, const Poco::AbstractObserver& observer);
                    
173		/// Unregisters an event handler with the SocketReactor.
                    
200
                    
201	void dispatch(const Socket& socket, SocketNotification* pNotification);
                    
202		/// Dispatches the given notification to all observers
                    
                
mdns-ffi.lisp http://cl-dns-sd.googlecode.com/svn/trunk/ | Lisp | 194 lines
                    
75
                    
76;; A wrapper around DNSServiceRefSockFD that raises a SOCKET-FD-ERROR
                    
77;; if the returned value is -1.  It seems that if the mDNS daemon
                    
83    (if (eql sock -1)
                    
84        (error 'socket-fd-error :oid ref)
                    
85        sock)))
                    
                
TcpSocket.h https://bitbucket.org/CatrinaEmu/core/ | C++ Header | 357 lines
                    
29*/
                    
30#ifndef _SOCKETS_TcpSocket_H
                    
31#define _SOCKETS_TcpSocket_H
                    
51    \ingroup basic */
                    
52class TcpSocket : public StreamSocket
                    
53{
                    
266protected:
                    
267    TcpSocket(const TcpSocket& );
                    
268    void OnRead();
                    
300private:
                    
301    TcpSocket& operator=(const TcpSocket& ) { return *this; }
                    
302
                    
353
                    
354#endif // _SOCKETS_TcpSocket_H
                    
355
                    
                
Address.java http://dataturbine.googlecode.com/svn/trunk/ | Java | 559 lines
                    
39 * <p>
                    
40 * The <code>TCP</code> class provides the low-level TCP socket handling
                    
41 * methods for using TCP server sockets as the address of an RBNB DataTurbine
                    
49 * handling of the memory-to-memory copies.  It is the RAM equivalent of a
                    
50 * standard TCP socket.
                    
51 * <p>
                    
53 * side handling of the memory-to-memory copies.  It is the RAM equivalent of a
                    
54 * TCP server socket.
                    
55 * <p>
                    
384	    } else if (type.equalsIgnoreCase("TCP:")) {
                    
385		// TCP addresses use the TCP class for TCP socket to server
                    
386		// socket communications.
                    
                
TestPackage.java git://github.com/JetBrains/intellij-community.git | Java | 287 lines
                    
64    final TestClassFilter classFilter = computeFilter(data);
                    
65    return new SearchForTestsTask(getConfiguration().getProject(), myServerSocket) {
                    
66      private final Set<Location<?>> myClasses = new LinkedHashSet<>();
                    
204
                    
205    createServerSocket(javaParameters);
                    
206    return javaParameters;
                    
                
openssl_operation.hpp http://openqwaq.googlecode.com/svn/trunk/ | C++ Header | 517 lines
                    
28#include "asio/write.hpp"
                    
29#include "asio/detail/socket_ops.hpp"
                    
30#include "asio/ssl/detail/openssl_types.hpp"
                    
86  openssl_operation(ssl_primitive_func primitive,
                    
87                    Stream& socket,
                    
88                    net_buffer& recv_buf,
                    
97    , recv_buf_(recv_buf)
                    
98    , socket_(socket)
                    
99    , ssl_bio_(ssl_bio)
                    
117  openssl_operation(ssl_primitive_func primitive,
                    
118                    Stream& socket,
                    
119                    net_buffer& recv_buf,
                    
124    , recv_buf_(recv_buf)
                    
125    , socket_(socket)
                    
126    , ssl_bio_(ssl_bio)
                    
                
test_urllib2net.py https://bitbucket.org/arigo/cpython-withatomic/ | Python | 365 lines
                    
7import os
                    
8import socket
                    
9import urllib.error
                    
80
                    
81class CloseSocketTest(unittest.TestCase):
                    
82
                    
84        # calling .close() on urllib2's response objects should close the
                    
85        # underlying socket
                    
86        url = "http://www.python.org/"
                    
135##     def test_cnri(self):
                    
136##         if socket.gethostname() == 'bitdiddle':
                    
137##             localhost = 'bitdiddle.cnri.reston.va.us'
                    
137##             localhost = 'bitdiddle.cnri.reston.va.us'
                    
138##         elif socket.gethostname() == 'bitdiddle.concentric.net':
                    
139##             localhost = 'localhost'
                    
                
email.parser.rst https://bitbucket.org/arigo/cpython-withatomic/ | ReStructuredText | 292 lines
                    
27a stream which might block waiting for more input (e.g. reading an email message
                    
28from a socket).  The :class:`FeedParser` can consume and parse the message
                    
29incrementally, and only returns the root object when you close the parser [#]_.
                    
43as would be necessary when reading the text of an email message from a source
                    
44that can block (e.g. a socket).  The :class:`FeedParser` can of course be used
                    
45to parse an email message fully contained in a string or a file, but the classic
                    
                
HttpClientService.java http://andrico.googlecode.com/svn/trunk/ | Java | 354 lines
                    
40import org.apache.http.conn.ClientConnectionManager;
                    
41import org.apache.http.conn.scheme.PlainSocketFactory;
                    
42import org.apache.http.conn.scheme.Scheme;
                    
43import org.apache.http.conn.scheme.SchemeRegistry;
                    
44import org.apache.http.conn.scheme.SocketFactory;
                    
45import org.apache.http.entity.mime.MultipartEntity;
                    
186        // by the default operator to look up socket factories.
                    
187        final SocketFactory sf = PlainSocketFactory.getSocketFactory();
                    
188        supportedSchemes.register(new Scheme("http", sf, 80));
                    
                
fake.php https://code.google.com/p/php-blackops-rcon/ | PHP | 546 lines
                    
30    /**
                    
31     * Socket res
                    
32     *
                    
34     */
                    
35    protected $socket = NULL;
                    
36
                    
103    {
                    
104        //fclose($this->socket);
                    
105    }
                    
118    /**
                    
119     * Get socket resource
                    
120     *
                    
122     */
                    
123    public function get_socket()
                    
124    {
                    
                
AbstractClient.java http://loon-simple.googlecode.com/svn/trunk/ | Java | 508 lines
                    
100		sc.init(null, trustAllCerts, null);
                    
101		javax.net.ssl.HttpsURLConnection.setDefaultSSLSocketFactory(sc
                    
102				.getSocketFactory());
                    
402				port, file, connection.getContentLength(), threads, tmp_file);
                    
403		SocketManager sm = new SocketManager(info);
                    
404		ExternalDownload down = new ExternalDownload(header, sm);
                    
                
all-index-S.html http://as3mp3streamplayer.googlecode.com/svn/trunk/ | HTML | 123 lines
                    
41<td width="20"></td><td>
                    
42  Dispatched when the socket throws a security error
                    
43  </td>
                    
                
taskmanager.c http://garakuta-okiba.googlecode.com/svn/trunk/ | C | 242 lines
                    
70
                    
71void Task_Add(_funcpointer fp, void *socket0, void *socket1, int count)
                    
72{
                    
83  task_item->fp = fp;
                    
84  task_item->option.socket[0] = socket0;
                    
85  task_item->option.socket[1] = socket1;
                    
                
libFtp.tcl http://nxscripts.googlecode.com/svn/ | TCL | 500 lines
                    
91    # ftp(queue)  - Event queue (FIFO).
                    
92    # ftp(sock)   - Socket channel.
                    
93    # ftp(status) - Connection status (0=disconnected, 1=connecting, 2=connected).
                    
157
                    
158    # Asynchronous sockets in Tcl are created immediately but may not be
                    
159    # connected yet. The writable channel event callback is executed when
                    
159    # connected yet. The writable channel event callback is executed when
                    
160    # the socket is connected or if the connection failed.
                    
161    set ftp(sock) [socket -async $ftp(host) $ftp(port)]
                    
276
                    
277        # Send the QUIT command and terminate the socket.
                    
278        catch {puts $ftp(sock) "QUIT"}
                    
                
name_table.h git://github.com/torvalds/linux.git | C Header | 152 lines
                    
57 * @scope: scope of publication, TIPC_NODE_SCOPE or TIPC_CLUSTER_SCOPE
                    
58 * @node: network address of publishing socket's node
                    
59 * @port: publishing port
                    
67 * @binding_sock: all publications from the same socket which bound this one
                    
68 *   Used by socket to withdraw publications when socket is unbound/released
                    
69 * @local_publ: list of identical publications made from this node
                    
                
beos.c git://github.com/zpao/spidernode.git | C | 264 lines
                    
44#include <sys/types.h>
                    
45#include <sys/socket.h>
                    
46#include <sys/time.h>
                    
                
SwivelHingeJoint.cs https://hg01.codeplex.com/bepuphysics | C# | 134 lines
                    
24            IsActive = false;
                    
25            BallSocketJoint = new BallSocketJoint();
                    
26            AngularJoint = new SwivelHingeAngularJoint();
                    
31
                    
32            Add(BallSocketJoint);
                    
33            Add(AngularJoint);
                    
52                connectionB = TwoEntityConstraint.WorldEntity;
                    
53            BallSocketJoint = new BallSocketJoint(connectionA, connectionB, anchor);
                    
54            AngularJoint = new SwivelHingeAngularJoint(connectionA, connectionB, hingeAxis, -BallSocketJoint.OffsetB);
                    
56            HingeMotor = new RevoluteMotor(connectionA, connectionB, hingeAxis);
                    
57            TwistLimit = new TwistLimit(connectionA, connectionB, BallSocketJoint.OffsetA, -BallSocketJoint.OffsetB, 0, 0);
                    
58            TwistMotor = new TwistMotor(connectionA, connectionB, BallSocketJoint.OffsetA, -BallSocketJoint.OffsetB);
                    
111        /// </summary>
                    
112        public BallSocketJoint BallSocketJoint { get; private set; }
                    
113
                    
                
TcpServer.fs git://github.com/fractureio/fracture.git | F# | 0 lines
                    
21    let connections = ref 0
                    
22    let listeningSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)
                    
23    let mutable disposed = false
                    
50    and processAccept (args) =
                    
51        let acceptSocket = args.AcceptSocket
                    
52        match args.SocketError with
                    
82        | SocketError.Disconnecting when disposed -> ()// stop accepting here, we're being shutdown.
                    
83        | _ -> Debug.WriteLine (sprintf "socket error on accept: %A" args.SocketError)
                    
84         
                    
91        let socket = sd.Socket
                    
92        if args.SocketError = SocketError.Success && args.BytesTransferred > 0 then
                    
93            //process received data, check if data was given on connection.
                    
116            failwith "Buffer overflow or send buffer timeout" //graceful termination?  
                    
117        | _ -> args.SocketError.ToString() |> printfn "socket error on send: %s"
                    
118
                    
                
GCDetailAttrib.h http://mmo-resourse.googlecode.com/svn/ | C Header | 318 lines
                    
30		//??????
                    
31		virtual BOOL			Read( SocketInputStream& iStream ) ;
                    
32		virtual BOOL			Write( SocketOutputStream& oStream )const ;
                    
                
ProxyClientFactory.cs http://counterstrike.googlecode.com/svn/trunk/ | C# | 209 lines
                    
28using System.Text;
                    
29using System.Net.Sockets;
                    
30
                    
72	/// // create a connection through the proxy to www.starksoft.com over port 80
                    
73    /// System.Net.Sockets.TcpClient tcpClient = proxy.CreateConnection("www.starksoft.com", 80);
                    
74    /// </code>
                    
                
NSSelectSet_windows.m https://code.google.com/p/cocotron/ | Objective C | 443 lines
                    
276
                    
277    result->pingWrite=[[NSSocket alloc] initConnectedToSocket:&result->pingRead];
                    
278    [result->pingRead retain];
                    
330   NSEnumerator     *state=[set objectEnumerator];
                    
331   NSSocket_windows *socket;
                    
332   
                    
333   while((socket=[state nextObject])!=nil)
                    
334    native_set_set(native,[socket socketHandle]);
                    
335}
                    
340   for(i=0;i<native->fdset->fd_count;i++)
                    
341    [set addObject:[[[NSSocket_windows alloc] initWithSocketHandle:native->fdset->fd_array[i]] autorelease]];
                    
342}
                    
401   NSError          *result=nil;
                    
402   NSSocket_windows *cheater=[NSSocket_windows socketWithSocketHandle:0];
                    
403   NSTimeInterval    interval=[beforeDate timeIntervalSinceNow];
                    
                
Handle.pm http://perl5005.googlecode.com/svn/trunk/ | Perl | 540 lines
                    
177trampling on each other I propose the that any such module should prefix
                    
178its variables with its own name separated by _'s. For example the IO::Socket
                    
179module keeps a C<timeout> variable in 'io_socket_timeout'.
                    
                
irc2you-server.py https://code.google.com/p/irc2you/ | Python | 268 lines
                    
67            pid, uid, gid = struct.unpack('3i', \
                    
68                    self.request.getsockopt(socket.SOL_SOCKET, 17, \
                    
69                    struct.calcsize('3i')))
                    
171                            channel = objectify.fromstring(messageXML, getNick)
                    
172                            for conection in  listofSockets:
                    
173                               if str(channel.returnport) in conection:
                    
198        pid, uid, gid = struct.unpack('3i', \
                    
199                self.request.getsockopt(socket.SOL_SOCKET, 17, \
                    
200                struct.calcsize('3i')))
                    
250    # Set named socket path and delete old socket, if any
                    
251    namedsocket = os.path.join(tempfile.gettempdir(), 'irc2you_socket')
                    
252    if(os.path.exists(namedsocket)):
                    
253        os.remove(namedsocket)
                    
254    #server = SocketServer.UnixStreamServer(namedsocket, MyHandler)
                    
255    server = ThreadingUnixStreamServer(namedsocket, MyHandler)
                    
                
test_asyncore.py http://unladen-swallow.googlecode.com/svn/trunk/ | Python | 415 lines
                    
31    def __init__(self):
                    
32        self.socket = dummysocket()
                    
33
                    
195        if usedefault:
                    
196            socketmap = asyncore.socket_map
                    
197            try:
                    
200            finally:
                    
201                testmap, asyncore.socket_map = asyncore.socket_map, socketmap
                    
202        else:
                    
333        self.evt = threading.Event()
                    
334        self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
                    
335        self.sock.settimeout(3)
                    
347        d = dispatcherwithsend_noread()
                    
348        d.create_socket(socket.AF_INET, socket.SOCK_STREAM)
                    
349        d.connect((HOST, self.port))
                    
                
SOCK_Connector.cpp git://github.com/insider42/mangos.git | C++ | 363 lines
                    
6#include "ace/OS_NS_unistd.h"
                    
7#include "ace/OS_NS_sys_socket.h"
                    
8#include "ace/os_include/os_fcntl.h"
                    
37
                    
38  // Only open a new socket if we don't already have a valid handle.
                    
39  if (new_stream.get_handle () == ACE_INVALID_HANDLE
                    
59
                    
60  // Only open a new socket if we don't already have a valid handle.
                    
61  if (new_stream.get_handle () == ACE_INVALID_HANDLE
                    
121#if defined(ACE_WIN32)
                    
122              // In order to detect when the socket that has been
                    
123              // bound to is in TIME_WAIT we need to do the connect
                    
128              // error state. The error code is then retrieved with
                    
129              // getsockopt(). Good sockets however will return from
                    
130              // the select() with ETIME - in this case return
                    
                
TCPTransportClient.java http://mobicents.googlecode.com/svn/trunk/ | Java | 367 lines
                    
98    }
                    
99    socketChannel = SelectorProvider.provider().openSocketChannel();
                    
100    if (origAddress != null) {
                    
116    socketChannel.configureBlocking(true);
                    
117    destAddress = new InetSocketAddress(socket.getInetAddress(), socket.getPort());
                    
118  }
                    
122    if(socketDescription == null && socketChannel != null) {
                    
123      socketDescription = socketChannel.socket().toString();
                    
124    }
                    
187  public void stop() throws Exception {
                    
188    logger.debug("Stopping transport. Socket is [{}]", socketDescription);
                    
189    stop = true;
                    
273  boolean isConnected() {
                    
274    return socketChannel != null && socketChannel.isConnected();
                    
275  }
                    
                
sckaddr.h http://dynamica.googlecode.com/svn/trunk/ | C Header | 324 lines
                    
20#elif defined(__VMS__)
                    
21    #include <socket.h>
                    
22
                    
31    #include <sys/types.h>
                    
32    #include <sys/socket.h>
                    
33    #include <netinet/in.h>
                    
65
                    
66#ifdef wxHAS_UNIX_DOMAIN_SOCKETS
                    
67template <> struct AddressFamily<sockaddr_un> { enum { value = AF_UNIX }; };
                    
67template <> struct AddressFamily<sockaddr_un> { enum { value = AF_UNIX }; };
                    
68#endif // wxHAS_UNIX_DOMAIN_SOCKETS
                    
69
                    
73
                    
74// Represents a socket endpoint, e.g. an (address, port) pair for PF_INET
                    
75// sockets. It can be initialized from an existing sockaddr struct and also
                    
                
meteobox.c git://github.com/Yniold/liftsrc.git | C | 353 lines
                    
46#include <pthread.h>
                    
47#include <sys/socket.h>
                    
48#include <sys/types.h>
                    
126{
                    
127   .iFD = -1,                      /* socket FD */
                    
128     .Valid = 0,                /* signal if data is valid or not to main thread */
                    
138
                    
139// bind to socket and create the parser thread
                    
140//
                    
175
                    
176   // socket structure
                    
177   struct sockaddr_in ServerAddress;
                    
187
                    
188	     // create SocketFD
                    
189	     sStructure->iFD = socket(AF_INET, SOCK_STREAM, 0);
                    
                
dlmast.c git://github.com/torvalds/linux.git | C | 487 lines
                    
20#include <linux/blkdev.h>
                    
21#include <linux/socket.h>
                    
22#include <linux/inet.h>
                    
                
EvDns.d http://gool.googlecode.com/svn/trunk/ | D | 232 lines
                    
98struct nameserver {
                    
99	evutil_socket_t		socket;	 /* a connected UDP socket */
                    
100	sockaddr_storage		address;
                    
109	char				state;  /* zero if we think that this server is down */
                    
110	char				choked;  /* true if we have an EAGAIN from this server's socket */
                    
111	char				write_waiting;  /* true if we are waiting for EV_WRITE events */
                    
116struct evdns_server_port {
                    
117	evutil_socket_t	socket; /* socket we use to read queries and write replies. */
                    
118	int			refcnt; /* reference count. */
                    
                
test_telnetlib.py https://bitbucket.org/mirror/python-trunk/ | Python | 371 lines
                    
36                data = data[written:]
                    
37    except socket.timeout:
                    
38        pass
                    
46        self.evt = threading.Event()
                    
47        self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
                    
48        self.sock.settimeout(3)
                    
65    def testTimeoutDefault(self):
                    
66        self.assertTrue(socket.getdefaulttimeout() is None)
                    
67        socket.setdefaulttimeout(30)
                    
70        finally:
                    
71            socket.setdefaulttimeout(None)
                    
72        self.assertEqual(telnet.sock.gettimeout(), 30)
                    
99    self.dataq = Queue.Queue()
                    
100    self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
                    
101    self.sock.settimeout(3)
                    
                
tm_server.cpp http://itexmacs.googlecode.com/svn/trunk/ | C++ | 455 lines
                    
20#include "tm_link.hpp"
                    
21#include "socket_notifier.hpp"
                    
22
                    
311#ifdef QTTEXMACS
                    
312  // TeXmacs/Qt handles delayed messages and socket notification
                    
313  // in its own runloop
                    
                
ClientDatagramAttachment.java http://xerela.googlecode.com/svn/trunk/ | Java | 199 lines
                    
23import java.io.IOException;
                    
24import java.net.InetSocketAddress;
                    
25import java.net.SocketAddress;
                    
55    private final byte[] inArr;
                    
56    private final SocketAddress serverAddr;
                    
57    private final SharedBuffer.User sendUser;
                    
64    // -- constructors
                    
65    public ClientDatagramAttachment(final byte[] initOutArr, final int initOutLen, final SocketAddress serverAddress, final ChannelWriter writer,
                    
66            final ILogger logger, final Integer bufferSize)
                    
150            DatagramChannel chan = ((DatagramChannel) key.channel());
                    
151            InetSocketAddress serverAddr = (InetSocketAddress) receive(chan, buf);
                    
152            if (0 == buf.position() || null == serverAddr)
                    
192        {
                    
193            return (InetSocketAddress) chan.socket().getLocalSocketAddress();
                    
194        }
                    
                
llcp.h git://github.com/torvalds/linux.git | C++ Header | 221 lines
                    
85
                    
86	/* sockets array */
                    
87	struct llcp_sock_list sockets;
                    
87	struct llcp_sock_list sockets;
                    
88	struct llcp_sock_list connecting_sockets;
                    
89	struct llcp_sock_list raw_sockets;
                    
191/* Sock API */
                    
192struct sock *nfc_llcp_sock_alloc(struct socket *sock, int type, gfp_t gfp);
                    
193void nfc_llcp_sock_free(struct nfc_llcp_sock *sock);
                    
195void nfc_llcp_accept_enqueue(struct sock *parent, struct sock *sk);
                    
196struct sock *nfc_llcp_accept_dequeue(struct sock *sk, struct socket *newsock);
                    
197
                    
217
                    
218/* Socket API */
                    
219int __init nfc_llcp_sock_init(void);
                    
                
errno.d git://github.com/SiegeLord/Tango-D2.git | D | 154 lines
                    
57    EIO = 5, // Input/output error
                    
58    EISCONN = 106, // Socket is already connected
                    
59    EISDIR = 21, // Is a directory
                    
106    ENOTBLK = 15, // Block device required
                    
107    ENOTCONN = 107, // Socket is not connected
                    
108    ENOTDIR = 20, // Not a directory
                    
111    ENOTRECOVERABLE = 131, // State not recoverable
                    
112    ENOTSOCK = 88, // Socket operation on non-socket
                    
113    ENOTSUP = 95, // Operation not supported
                    
116    ENXIO = 6, // Device not configured
                    
117    EOPNOTSUPP = 95, // Operation not supported on socket
                    
118    EOVERFLOW = 75, // Value too large to be stored in data type
                    
124    EPROTONOSUPPORT = 93, // Protocol not supported
                    
125    EPROTOTYPE = 91, // Protocol wrong type for socket
                    
126    ERANGE = 34, // Result too large
                    
                
writer.pl git://github.com/quartzjer/TeleHash.git | Perl | 451 lines
                    
9use IO::Select;
                    
10use Socket;
                    
11use JSON::DWIW;
                    
22$paddr = sockaddr_in($port, $iaddr);
                    
23socket(SOCKET, PF_INET, SOCK_DGRAM, $proto)   or die "socket: $!";
                    
24bind(SOCKET, $paddr)                          or die "bind: $!";
                    
25$sel = IO::Select->new();
                    
26$sel->add(\*SOCKET);
                    
27
                    
65	$connected = 1;
                    
66	my $caddr = recv(SOCKET, $buff, 8192, 0) || die("recv $!");
                    
67
                    
292	printf "SEND[%s]\t%s\n",$j->{"_to"},$js;
                    
293	if(!defined(send(SOCKET, $js, 0, $waddr)))
                    
294	{
                    
                
DatabaseMysql.cpp https://bitbucket.org/KPsN/trinitycore/ | C++ | 439 lines
                    
92
                    
93    std::string host, port_or_socket, user, password, database;
                    
94    int port;
                    
94    int port;
                    
95    char const* unix_socket;
                    
96
                    
101    if (iter != tokens.end())
                    
102        port_or_socket = *iter++;
                    
103    if (iter != tokens.end())
                    
116        port = 0;
                    
117        unix_socket = 0;
                    
118    }
                    
130        port = 0;
                    
131        unix_socket = port_or_socket.c_str();
                    
132    }
                    
                
smscommon.lua http://luasms.googlecode.com/svn/trunk/ | Lua | 432 lines
                    
1socket = require("socket")
                    
2json = require("json")
                    
18	if level <= DEBUG then
                    
19--		io.write(string.format("%s %s:%s %s ",os.date("%x %X",socket.gettime()), PROGRAM, FUNCTION,stipo))
                    
20		if level < 5 then
                    
20		if level < 5 then
                    
21			io.write(string.format("%s %s",os.date("%x %X", socket.gettime()), stipo))
                    
22		else
                    
36function leer(dev)
                    
37	local t1 	= socket.gettime()
                    
38	local str		= ""
                    
44		local e, rspta = dev:read(1,100)
                    
45		if socket.gettime() - t1 > 5 then 
                    
46			return {text=str, status="ERROR TimeOut", rawdata=text}, text, status, str, "timeout"
                    
61		else
                    
62			t1 = socket.gettime()
                    
63			str = str .. rspta
                    
                
Server.java http://mobilelua.googlecode.com/svn/trunk/ | Java | 473 lines
                    
193		{
                    
194			mServerSocket = new ServerSocket(mPort);
                    
195			
                    
198				Log.i("Waiting for client connection");
                    
199				Socket socket = mServerSocket.accept();
                    
200				Log.i("Client connection accepted");
                    
215		private Server mServer;
                    
216		private ServerSocket mServerSocket;
                    
217		
                    
260				Log.i("Waiting for editor connection");
                    
261				Socket socket = mServerSocket.accept();
                    
262				Log.i("Editor connection accepted");
                    
272	{
                    
273		private Socket mSocket;
                    
274		private Server mServer;
                    
                
httpd.tcl http://puttyknife.googlecode.com/svn/trunk/ | TCL | 351 lines
                    
15#  port:	The port this server is serving
                    
16#  listen:	the main listening socket id
                    
17#  accepts:	a count of accepted connections so far
                    
68    if {$Httpd(-ipaddr) != ""} {
                    
69	set Httpd(listen) [socket -server HttpdAccept \
                    
70				-myaddr $Httpd(-ipaddr) $Httpd(-port)]
                    
71    } else {
                    
72	set Httpd(listen) [socket -server HttpdAccept $Httpd(-port)]
                    
73    }
                    
149}
                    
150# Close a socket.
                    
151# We'll use this to implement keep-alives some day.
                    
                
sys_socket_h.ads http://opencvada.googlecode.com/svn/trunk/ | Ada | 273 lines
                    
78      uu_protocol : int) return int;  -- /usr/include/sys/socket.h:105:62
                    
79   pragma Import (C, socket, "socket");
                    
80
                    
163      Uu_Addr : access constant Linux_If_Packet_H.Sockaddr_Ll;
                    
164      uu_addr_len : bits_socket_h.socklen_t) return sys_types_h.ssize_t;  -- /usr/include/sys/socket.h:157:30
                    
165   pragma Import (C, sendto, "sendto");
                    
213      uu_optval : System.Address;
                    
214      uu_optlen : access bits_socket_h.socklen_t) return int;  -- /usr/include/sys/socket.h:192:42
                    
215   pragma Import (C, getsockopt, "getsockopt");
                    
225      uu_optval : System.Address;
                    
226      uu_optlen : bits_socket_h.socklen_t) return int;  -- /usr/include/sys/socket.h:198:54
                    
227   pragma Import (C, setsockopt, "setsockopt");
                    
246      uu_addr : access bits_socket_h.sockaddr;
                    
247      uu_addr_len : access bits_socket_h.socklen_t) return int;  -- /usr/include/sys/socket.h:215:38
                    
248   pragma Import (C, c_accept, "accept");
                    
                
platform.hpp https://bitbucket.org/brandon/pyzmq-static/ | C++ Header | 230 lines
                    
48
                    
49/* Define to 1 if you have the `socket' library (-lsocket). */
                    
50/* #undef HAVE_LIBSOCKET */
                    
75
                    
76/* Define to 1 if you have the `socket' function. */
                    
77#define HAVE_SOCKET 1
                    
96
                    
97/* Define to 1 if you have the <sys/socket.h> header file. */
                    
98#define HAVE_SYS_SOCKET_H 1
                    
                
callback.c git://github.com/CyanogenMod/cm-kernel.git | C | 257 lines
                    
84		/*
                    
85		 * Listen for a request on the socket
                    
86		 */
                    
163out_err:
                    
164	dprintk("NFS: Couldn't create callback socket or server thread; "
                    
165		"err = %d\n", ret);
                    
                
cardbus.c git://github.com/CyanogenMod/cm-kernel.git | C | 252 lines
                    
86    cards.  The "result" that is used externally is the cb_cis_virt
                    
87    pointer in the struct pcmcia_socket structure.
                    
88    
                    
90
                    
91static void cb_release_cis_mem(struct pcmcia_socket * s)
                    
92{
                    
100
                    
101static int cb_setup_cis_mem(struct pcmcia_socket * s, struct resource *res)
                    
102{
                    
129
                    
130int read_cb_mem(struct pcmcia_socket * s, int space, u_int addr, u_int len, void *ptr)
                    
131{
                    
209
                    
210int __ref cb_alloc(struct pcmcia_socket * s)
                    
211{
                    
                
Makefile.am git://github.com/bagder/curl.git | Makefile | 131 lines
                    
39 libcurl-tutorial.3 curl_easy_reset.3 curl_easy_escape.3		 \
                    
40 curl_easy_unescape.3 curl_multi_setopt.3 curl_multi_socket.3		 \
                    
41 curl_multi_timeout.3 curl_formget.3 curl_multi_assign.3		 \
                    
42 curl_easy_pause.3 curl_easy_recv.3 curl_easy_send.3			 \
                    
43 curl_multi_socket_action.3 curl_multi_wait.3 libcurl-symbols.3 	 \
                    
44 libcurl-thread.3 curl_multi_socket_all.3
                    
60 libcurl-tutorial.html curl_easy_reset.html curl_easy_escape.html	\
                    
61 curl_easy_unescape.html curl_multi_setopt.html curl_multi_socket.html	\
                    
62 curl_multi_timeout.html curl_formget.html curl_multi_assign.html	\
                    
63 curl_easy_pause.html curl_easy_recv.html curl_easy_send.html		\
                    
64 curl_multi_socket_action.html curl_multi_wait.html			\
                    
65 libcurl-symbols.html libcurl-thread.html curl_multi_socket_all.html
                    
81 curl_easy_reset.pdf curl_easy_escape.pdf curl_easy_unescape.pdf	 \
                    
82 curl_multi_setopt.pdf curl_multi_socket.pdf curl_multi_timeout.pdf	 \
                    
83 curl_formget.pdf curl_multi_assign.pdf curl_easy_pause.pdf		 \
                    
                
write.c http://newcnix.googlecode.com/svn/trunk/ | C | 343 lines
                    
36
                    
37extern ssize_t socket_write(
                    
38	struct inode * inoptr,
                    
74
                    
75	if(is_socket(inoptr)){
                    
76		writed = socket_write(
                    
                
pserver.cc https://octave.svn.sourceforge.net/svnroot/octave | C++ | 592 lines
                    
291      if(sock==-1){
                    
292	perror("socket ");
                    
293	int len=118;
                    
381	      ol=sizeof(val);
                    
382	      setsockopt(asock,SOL_SOCKET,SO_REUSEADDR,&val,ol);
                    
383	      
                    
420		  setsockopt(dasock,SOL_SOCKET,SO_SNDBUF,&bufsize,ol);
                    
421		  setsockopt(dasock,SOL_SOCKET,SO_RCVBUF,&bufsize,ol);
                    
422		  bufsize=1;
                    
423		  ol=sizeof(bufsize);
                    
424		  setsockopt(dasock,SOL_SOCKET,SO_REUSEADDR,&bufsize,ol);
                    
425		  
                    
553	      for(i=1;i<=num_nodes;i++){
                    
554		sprintf(s,"sockets=[sockets;%d,0,%d]",sock_v[i+2*(num_nodes+1)]);
                    
555		eval_string(std::string(s),true,stat);
                    
                
parallel.py git://git.savannah.nongnu.org/par.git | Python | 331 lines
                    
32
                    
33import commands, os, socket, subprocess, sys, tempfile, time, thread
                    
34import Pyro.core, Pyro.naming
                    
                
turn_sock.h http://csipsimple.googlecode.com/svn/trunk/ | C Header | 398 lines
                    
105 * This structure describes options that can be specified when creating
                    
106 * the TURN socket. Application should call #pj_turn_sock_cfg_default()
                    
107 * to initialize this structure with its default values before using it.
                    
129    /**
                    
130     * Specify if STUN socket should ignore any errors when setting the QoS
                    
131     * traffic type/parameters.
                    
181 * connection between the client and the TURN server. Although this
                    
182 * function will return immediately, the TURN socket deletion may continue
                    
183 * in the background and the application may still get state changes
                    
327 * @param addr		Array of peer IP addresses. Only the address family
                    
328 *			and IP address portion of the socket address matter.
                    
329 * @param options	Specify 1 to let the TURN client session automatically
                    
                
ppc-linux-os.c git://github.com/sbcl/sbcl.git | C | 187 lines
                    
28#include "lispregs.h"
                    
29#include <sys/socket.h>
                    
30#include <sys/utsname.h>
                    
                
ControllerThreadSocketFactory.java http://google-enterprise-connector-sharepoint.googlecode.com/svn/trunk/ | Java | 165 lines
                    
90                public void doit() throws IOException {
                    
91                    setSocket(socketfactory.createSocket(host, port, localAddress, localPort));
                    
92                }                 
                    
100            }
                    
101            Socket socket = task.getSocket();
                    
102            if (task.exception != null) {
                    
107
                    
108    public static Socket createSocket(final SocketTask task, int timeout)
                    
109     throws IOException, UnknownHostException, ConnectTimeoutException
                    
117            }
                    
118            Socket socket = task.getSocket();
                    
119            if (task.exception != null) {
                    
137         */
                    
138        protected void setSocket(final Socket newSocket) {
                    
139            socket = newSocket;
                    
                
plr.c https://plplot.svn.sourceforge.net/svnroot/plplot | C | 561 lines
                    
54 * otherwise pretty minimal.  A portable byte stream is used since network
                    
55 * communication over a socket may be used.
                    
56 *
                    
151 * may actually process an arbitrary number of LINE or LINETO commands.
                    
152 * Since the data buffer (fifo or socket) is only flushed after a complete
                    
153 * command, there should be no danger in rushing blindly ahead to execute
                    
                
ProtocolTest.java http://quickcached.googlecode.com/svn/trunk/ | Java | 526 lines
                    
2
                    
3import java.net.InetSocketAddress;
                    
4import java.util.Date;
                    
397		Iterator iterator = ver.keySet().iterator();
                    
398		InetSocketAddress key = null;
                    
399		while(iterator.hasNext()) {
                    
399		while(iterator.hasNext()) {
                    
400			key = (InetSocketAddress) iterator.next();
                    
401			assertNotNull(key);
                    
410		Iterator iterator = stats.keySet().iterator();
                    
411		InetSocketAddress key = null;
                    
412		while(iterator.hasNext()) {
                    
412		while(iterator.hasNext()) {
                    
413			key = (InetSocketAddress) iterator.next();
                    
414			assertNotNull(key);
                    
                
crossfire_test_client.py http://fbug.googlecode.com/svn/ | Python | 530 lines
                    
69  def start(self):
                    
70    #self.socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
                    
71    #try:
                    
81
                    
82    self.socket = socket.create_connection((self.host, self.port))
                    
83
                    
85    self.reader = PacketReader(self.socket, self.socketCondition)
                    
86    self.writer = PacketWriter(self.socket, self.socketCondition)
                    
87
                    
89    self.socket.send(HANDSHAKE_STRING)
                    
90    self.socket.send("\r\n")
                    
91    self.socket.send(TOOL_STRING)
                    
98      #self.conn.close()
                    
99      self.socket.close()
                    
100      #self.socketCondition.acquire()
                    
                
libslp_network.c https://openslp.svn.sourceforge.net/svnroot/openslp | C | 333 lines
                    
57    {
                    
58        G_SlpdSocket = socket(AF_INET,SOCK_STREAM,0);
                    
59        if(G_SlpdSocket >= 0)
                    
69                setsockopt(G_SlpdSocket,SOL_SOCKET,SO_RCVLOWAT,&lowat,sizeof(lowat));
                    
70                setsockopt(G_SlpdSocket,SOL_SOCKET,SO_SNDLOWAT,&lowat,sizeof(lowat));
                    
71
                    
85                  /* Could not connect to the slpd through the loopback */
                    
86                  close(G_SlpdSocket);
                    
87                  G_SlpdSocket = -1;
                    
103    
                    
104    return G_SlpdSocket;
                    
105}
                    
286    setsockopt(G_SlpdSocket,SOL_SOCKET,SO_RCVLOWAT,&lowat,sizeof(lowat));
                    
287    setsockopt(G_SlpdSocket,SOL_SOCKET,SO_SNDLOWAT,&lowat,sizeof(lowat));
                    
288    */
                    
                
fdmgr.cpp http://atf2flightsim.googlecode.com/svn/trunk/ | C++ | 338 lines
                    
44
                    
45    epicsShareFunc fdRegForOldFdmgr (const SOCKET fdIn, const fdRegType type, 
                    
46		const bool onceOnly, fdManager &manager, pCallBackFDMgr pFunc, void *pParam);
                    
108epicsShareFunc fdRegForOldFdmgr::fdRegForOldFdmgr 
                    
109    (const SOCKET fdIn, const fdRegType typeIn, 
                    
110	    const bool onceOnlyIn, fdManager &managerIn, 
                    
231extern "C" epicsShareFunc int epicsShareAPI fdmgr_add_callback ( // X aCC 361
                    
232    fdctx *pfdctx, SOCKET fd, enum fdi_type fdi, pCallBackFDMgr pFunc, void *pParam)
                    
233{
                    
273extern "C" epicsShareFunc int epicsShareAPI fdmgr_clear_callback ( // X aCC 361
                    
274    fdctx *pfdctx, SOCKET fd, enum fdi_type	fdi)
                    
275{
                    
324 */
                    
325extern "C" epicsShareFunc int epicsShareAPI fdmgr_clear_fd (fdctx *pfdctx, SOCKET fd)
                    
326{
                    
                
CustomTHsHaServer.java git://github.com/apache/cassandra.git | Java | 386 lines
                    
20import java.io.IOException;
                    
21import java.net.InetSocketAddress;
                    
22import java.nio.channels.SelectionKey;
                    
42import org.apache.thrift.transport.TNonblockingServerTransport;
                    
43import org.apache.thrift.transport.TNonblockingSocket;
                    
44import org.apache.thrift.transport.TNonblockingTransport;
                    
91    /**
                    
92     * Save the remote socket as a thead local for future use of client state.
                    
93     */
                    
107            TNonblockingSocket socket = (TNonblockingSocket) frameBuffer.trans_;
                    
108            ThriftSessionManager.instance.setCurrentSocket(socket.getSocketChannel().socket().getRemoteSocketAddress());
                    
109            frameBuffer.invoke();
                    
355            if(!DatabaseDescriptor.getClientEncryptionOptions().internode_encryption.equals(EncryptionOptions.InternodeEncryption.none))
                    
356                throw new RuntimeException("Client SSL is not supported for non-blocking sockets (hsha). Please remove client ssl from the configuration.");
                    
357
                    
                
cnx.h git://git.savannah.gnu.org/liquidwar6.git | C Header | 279 lines
                    
91 * on which backend is used to handle the connection, it will behave
                    
92 * differently. If you search for attributes such as socket id, search
                    
93 * for them in backend_specific_data which is, in fact, handle by the
                    
173  /**
                    
174   * Store backend data, this is when, for instance, a socket handle
                    
175   * will be kept, or a library handle (CURL, to name it). Common
                    
                
WS2_32Support.cs https://hg01.codeplex.com/apimon | C# | 327 lines
                    
144
                    
145        public enum SOCKET_TYPE : short {
                    
146            /// <summary>
                    
265        [DllImport("ws2_32.dll", CharSet = CharSet.Unicode, SetLastError = true, CallingConvention = CallingConvention.StdCall)]
                    
266        public static extern IntPtr WSASocketW(ADDRESS_FAMILIES af, SOCKET_TYPE socket_type, PROTOCOL protocol,
                    
267            IntPtr lpProtocolInfo, Int32 group, OPTION_FLAGS_PER_SOCKET dwFlags);
                    
268        [UnmanagedFunctionPointer(CallingConvention.StdCall, CharSet = CharSet.Unicode, SetLastError = true)]
                    
269        public delegate IntPtr DWSASocketW(ADDRESS_FAMILIES af, SOCKET_TYPE socket_type, PROTOCOL protocol,
                    
270          IntPtr lpProtocolInfo, Int32 group, OPTION_FLAGS_PER_SOCKET dwFlags);
                    
274        [UnmanagedFunctionPointer(CallingConvention.StdCall, CharSet = CharSet.Unicode, SetLastError = true)]
                    
275        public delegate int DWSAConnect(IntPtr socket, IntPtr lpSockAddr, int namelen, IntPtr lpCallerData, IntPtr lpCalleeData, IntPtr lpSQOS, IntPtr lpGQOS);
                    
276
                    
317        [UnmanagedFunctionPointer(CallingConvention.StdCall, SetLastError = true)]
                    
318        public delegate int DWSASend(IntPtr socket, IntPtr lpBuffers, Int32 dwBufferCount, ref Int32 lpNumberOfBytesSent, int flags, IntPtr lpOverlapped, IntPtr lpCompletionRoutine);
                    
319
                    
                
nltk.wordnet.browser.browserver.MyServerHandler-class.html http://nltk.googlecode.com/svn/trunk/ | HTML | 354 lines
                    
67<pre class="base-tree">
                    
68SocketServer.BaseRequestHandler --+        
                    
69                                  |        
                    
69                                  |        
                    
70  SocketServer.StreamRequestHandler --+    
                    
71                                      |    
                    
204      </p>
                    
205    <p class="indent-wrapped-lines"><b>Inherited from <code>SocketServer.StreamRequestHandler</code></b>:
                    
206      <code>finish</code>,
                    
208      </p>
                    
209    <p class="indent-wrapped-lines"><b>Inherited from <code>SocketServer.BaseRequestHandler</code></b>:
                    
210      <code>__init__</code>
                    
242      </p>
                    
243    <p class="indent-wrapped-lines"><b>Inherited from <code>SocketServer.StreamRequestHandler</code></b>:
                    
244      <code>rbufsize</code>,
                    
                
os.c https://bitbucket.org/ericvh/hare/ | C | 648 lines
                    
23
                    
24#include 	<sys/socket.h>
                    
25#include	<sched.h>
                    
                
LogonCommServer.cpp http://wowtbc.googlecode.com/svn/trunk/ | C++ | 534 lines
                    
30
                    
31LogonCommServerSocket::LogonCommServerSocket(SOCKET fd) : Socket(fd, 65536, 524288)
                    
32{
                    
41
                    
42LogonCommServerSocket::~LogonCommServerSocket()
                    
43{
                    
46
                    
47void LogonCommServerSocket::OnDisconnect()
                    
48{
                    
56
                    
57		sInfoCore.RemoveServerSocket(this);
                    
58	}
                    
60
                    
61void LogonCommServerSocket::OnConnect()
                    
62{
                    
                
LdapConstants.java http://vt-middleware.googlecode.com/svn/ | Java | 353 lines
                    
37   * The value of this property is a string identifying the class name of a
                    
38   * socket factory. The value of this constant is {@value}.
                    
39   */
                    
39   */
                    
40  public static final String SOCKET_FACTORY = "java.naming.ldap.factory.socket";
                    
41
                    
                
HTReader.c http://atf2flightsim.googlecode.com/svn/trunk/ | C | 321 lines
                    
102    HTHost * host = me->host;
                    
103    SOCKET soc = HTChannel_socket(me->ch);
                    
104    HTNet * net = HTHost_getReadNet(host);
                    
107    if (!net->readStream) {
                    
108	HTTRACE(STREAM_TRACE, "Read Socket. No read stream for net object %p\n" _ net);
                    
109        return HT_ERROR;
                    
163		    HTTRACE(STREAM_TRACE, "Read Socket. got ESHUTDOWN\n" _ soc);
                    
164		    goto socketClosed;
                    
165#endif /* _WINSOCKAPI */
                    
175	    socketClosed:
                    
176		HTTRACE(STREAM_TRACE, "Read Socket. FIN received on socket %d\n" _ soc);
                    
177		HTHost_unregister(host, net, HTEvent_READ);
                    
206
                    
207	    HTTRACE(STREAM_TRACE, "Read Socket. %d bytes read from socket %d\n" _ 
                    
208			me->b_read _ soc);
                    
                
raw_socket_service.hpp http://hadesmem.googlecode.com/svn/trunk/ | C++ Header | 0 lines
                    
1//
                    
2// raw_socket_service.hpp
                    
3// ~~~~~~~~~~~~~~~~~~~~~~
                    
10
                    
11#ifndef BOOST_ASIO_RAW_SOCKET_SERVICE_HPP
                    
12#define BOOST_ASIO_RAW_SOCKET_SERVICE_HPP
                    
23#if defined(BOOST_ASIO_HAS_IOCP)
                    
24# include <boost/asio/detail/win_iocp_socket_service.hpp>
                    
25#else
                    
25#else
                    
26# include <boost/asio/detail/reactive_socket_service.hpp>
                    
27#endif
                    
132
                    
133  /// Assign an existing native socket to a raw socket.
                    
134  boost::system::error_code assign(implementation_type& impl,
                    
                
AES.cs https://hg01.codeplex.com/deltaengine | C# | 282 lines
                    
60		/// the data stream and the privateKey. Since this is not very secure it is
                    
61		/// only used for testing, see <see cref="SocketHelper.SendMessageBytes"/>
                    
62		/// on a real use case, which uses the instance methods of this class.
                    
108		/// privateKey. Since this is not very secure it is only used for testing,
                    
109		/// see <see cref="SocketHelper.SendMessageBytes"/> on a real use case,
                    
110		/// which uses the instance methods of this class.
                    
                
pdmg_exclusions.lua http://propdamage.googlecode.com/svn/trunk/ | Lua | 307 lines
                    
63				"gmod_wire_datarate",
                    
64				"gmod_wire_datasocket",
                    
65				"gmod_wire_detcord",
                    
142				"gmod_wire_simple_servo",
                    
143				"gmod_wire_socket",
                    
144				"gmod_wire_soundemitter",
                    
                
Manager.java http://ops.googlecode.com/svn/trunk/ | Java | 240 lines
                    
25import java.net.InetAddress;
                    
26import java.net.MulticastSocket;
                    
27import java.net.UnknownHostException;
                    
46    
                    
47    private MulticastSocket multicastSocket;
                    
48    
                    
59        {
                    
60            multicastSocket = new MulticastSocket(MANAGER_PORT);
                    
61            multicastSocket.joinGroup(InetAddress.getByName("235.5.5.5"));
                    
116            {
                    
117                multicastSocket.receive(p);
                    
118                
                    
215            {
                    
216                multicastSocket = new MulticastSocket(Manager.MANAGER_PORT);
                    
217                multicastSocket.joinGroup(InetAddress.getByName("235.5.5.5"));
                    
                
TCP.pm http://cernvm-copilot-monitor.googlecode.com/svn/trunk/ | Perl | 320 lines
                    
8
                    
9Container class for a TCP server. Copilot::Container::TCP is a child of Copilot::Container class. This class creates a listeing TCP socket and also allows to 
                    
10open client sockets to send data. The class also provides logging for the component.
                    
                
linux_if_h.ads http://opencvada.googlecode.com/svn/trunk/ | Ada | 255 lines
                    
2limited with linux_hdlc_ioctl_h;
                    
3with bits_socket_h;
                    
4with System;
                    
94  -- * INET		An implementation of the TCP/IP protocol suite for the LINUX
                    
95  -- *		operating system.  INET is implemented using the  BSD Socket
                    
96  -- *		interface as the means of communication with the user level.
                    
172  -- interface settings
                    
173  -- * Interface request structure used for socket
                    
174  -- * ioctl's.  All interface ioctl's must have parameter
                    
193         when 0 =>
                    
194         ifru_addr : aliased bits_socket_h.sockaddr;  -- /usr/include/linux/if.h:168:19
                    
195         when 1 =>
                    
195         when 1 =>
                    
196         ifru_dstaddr : aliased bits_socket_h.sockaddr;  -- /usr/include/linux/if.h:169:19
                    
197         when 2 =>
                    
                
slpd_knownda.h https://openslp.svn.sourceforge.net/svnroot/openslp | C++ Header | 227 lines
                    
189void SLPDKnownDAActiveDiscovery(int seconds);
                    
190/* Add a socket to the outgoing list to do active DA discovery SrvRqst     */
                    
191/*									                                       */
                    
                
package-tree.html http://roma-prj.googlecode.com/svn/trunk/ | HTML | 180 lines
                    
107<LI TYPE="circle">jp.co.rakuten.rit.roma.client.<A HREF="../../../../../../jp/co/rakuten/rit/roma/client/JakartaConnectionPoolImpl.html" title="class in jp.co.rakuten.rit.roma.client"><B>JakartaConnectionPoolImpl</B></A> (implements jp.co.rakuten.rit.roma.client.<A HREF="../../../../../../jp/co/rakuten/rit/roma/client/ConnectionPool.html" title="interface in jp.co.rakuten.rit.roma.client">ConnectionPool</A>)
                    
108<LI TYPE="circle">jp.co.rakuten.rit.roma.client.<A HREF="../../../../../../jp/co/rakuten/rit/roma/client/Node.html" title="class in jp.co.rakuten.rit.roma.client"><B>Node</B></A><LI TYPE="circle">jp.co.rakuten.rit.roma.client.<A HREF="../../../../../../jp/co/rakuten/rit/roma/client/RomaClientFactory.html" title="class in jp.co.rakuten.rit.roma.client"><B>RomaClientFactory</B></A><LI TYPE="circle">jp.co.rakuten.rit.roma.client.<A HREF="../../../../../../jp/co/rakuten/rit/roma/client/SocketPool.html" title="class in jp.co.rakuten.rit.roma.client"><B>SocketPool</B></A> (implements java.io.Closeable)
                    
109<LI TYPE="circle">java.lang.Throwable (implements java.io.Serializable)
                    
                
arp.cpp http://es-operating-system.googlecode.com/svn/trunk/ | C++ | 470 lines
                    
38
                    
39    Socket::addAddressFamily(this);
                    
40}
                    
238    // Set the interface MAC address to this address.
                    
239    NetworkInterface* nic = Socket::getInterface(a->getScopeID());
                    
240    ASSERT(nic);
                    
                
Mysql.php git://github.com/ushahidi/Ushahidi_Web.git | PHP | 492 lines
                    
56		// Build the connection info
                    
57		$host = isset($host) ? $host : $socket;
                    
58		$port = isset($port) ? ':'.$port : '';
                    
                
msdpls http://snmp-session.googlecode.com/svn/trunk/ | Perl | 304 lines
                    
6use BER;
                    
7use Socket;
                    
8
                    
                
http.lua http://luaxyssl.googlecode.com/svn/trunk/ | Lua | 352 lines
                    
10-------------------------------------------------------------------------------
                    
11local socket = require("socket")
                    
12local url = require("socket.url")
                    
27-- user agent field sent in request
                    
28USERAGENT = socket._VERSION
                    
29
                    
41        -- get field-name and value
                    
42        name, value = socket.skip(2, string.find(line, "^(.-):%s*(.*)"))
                    
43        if not (name and value) then return nil, "malformed reponse headers" end
                    
111    -- create socket with user connect function, or with default
                    
112    local c = socket.try((create or socket.tcp)(scheme))
                    
113    local h = base.setmetatable({ c = c }, metat)
                    
142    if headers["content-length"] then mode = "keep-open" end
                    
143    return self.try(ltn12.pump.all(source, socket.sink(mode, self.c), step))
                    
144end
                    
                
connection.hpp http://suckerserv.googlecode.com/svn/trunk/ | C++ Header | 359 lines
                    
77    {
                    
78        boost::asio::async_write(m_socket, boost::asio::buffer(data), boost::asio::transfer_at_least(data.length()), bind_io_handler(&connection::send_complete<CompletionHandler>, handler));
                    
79    }
                    
120    {
                    
121        return m_socket.is_open();   
                    
122    }
                    
194
                    
195        boost::asio::async_read(m_socket, m_read_buffer, 
                    
196            boost::asio::transfer_at_least(std::min(remaining, m_receive_buffer_size)), 
                    
338    boost::system::error_code m_send_error;
                    
339    boost::asio::ip::tcp::socket & m_socket;
                    
340    std::size_t m_receive_buffer_size;
                    
350    client_connection(boost::asio::io_service & service)
                    
351     :boost::asio::ip::tcp::socket(service), connection(*static_cast<boost::asio::ip::tcp::socket *>(this)){}
                    
352};
                    
                
configure.in git://git.savannah.nongnu.org/liquidwar.git | Autoconf | 558 lines
                    
105AC_CHECK_HEADER(string.h,,[AC_MSG_ERROR(Missing include file.)])
                    
106AC_CHECK_HEADER(sys/socket.h,,[AC_MSG_ERROR(Missing include file.)])
                    
107AC_CHECK_HEADER(sys/time.h,,[AC_MSG_ERROR(Missing include file.)])
                    
                
DispatchDnsServer.cs https://eddn.svn.codeplex.com/svn | C# | 386 lines
                    
4using System.Text;
                    
5using System.Net.Sockets;
                    
6using System.Net;
                    
                
DNSServer.java http://cmwrap.googlecode.com/svn/ | Java | 519 lines
                    
39
                    
40	private DatagramSocket srvSocket;
                    
41
                    
82		try {
                    
83			srvSocket = new DatagramSocket(srvPort, InetAddress
                    
84					.getByName("127.0.0.1"));
                    
165
                    
166		Socket innerSocket = new InnerSocketBuilder(proxyHost, proxyPort,
                    
167				target).getSocket();
                    
171		try {
                    
172			if (innerSocket != null && innerSocket.isConnected()) {
                    
173				// ??TCP DNS?
                    
214	private void sendDns(byte[] response, DatagramPacket dnsq,
                    
215			DatagramSocket srvSocket) {
                    
216
                    
                
HowToCreateP2P.pas http://swingamesdk.googlecode.com/svn/trunk/ | Pascal | 198 lines
                    
82begin
                    
83  CloseAllTCPReceiverSocket();
                    
84  CloseAllTCPHostSocket();
                    
86  LabelSetText('HostLbl', 'Connect');
                    
87  ListAddItem(aMenuPanel, 'MsgList',  'Listening Sockets Closed.');
                    
88  aStatus := False;
                    
93  BroadcastTCPMessage('[ClientDisconnect]');
                    
94  CloseAllTCPSenderSocket();
                    
95  LabelSetText('ClientStatusVal', 'Disconnected');
                    
113    begin
                    
114      CloseTCPReceiverSocket(GetIPFromMessage(), GetPortFromMessage());
                    
115      ListAddItem(aMenuPanel, 'MsgList',  GetIPFromMessage() + ' Disconnected.');
                    
                
WorldSocketMgr.cpp git://github.com/A-Metaphysical-Drama/BloodyCore.git | C++ | 365 lines
                    
136
                    
137            for (SocketSet::const_iterator i = m_NewSockets.begin(); i != m_NewSockets.end(); ++i)
                    
138            {
                    
258
                    
259    WorldSocket::Acceptor *acc = new WorldSocket::Acceptor;
                    
260    m_Acceptor = acc;
                    
294    {
                    
295        WorldSocket::Acceptor* acc = dynamic_cast<WorldSocket::Acceptor*> (m_Acceptor);
                    
296
                    
322int
                    
323WorldSocketMgr::OnSocketOpen (WorldSocket* sock)
                    
324{
                    
332        {
                    
333            sLog->outError ("WorldSocketMgr::OnSocketOpen set_option SO_SNDBUF");
                    
334            return -1;
                    
                
osiSock.h http://atf2flightsim.googlecode.com/svn/trunk/ | C Header | 209 lines
                    
31
                    
32epicsShareFunc SOCKET epicsShareAPI epicsSocketCreate ( 
                    
33    int domain, int type, int protocol );
                    
38epicsShareFunc void epicsShareAPI 
                    
39    epicsSocketEnableAddressReuseDuringTimeWaitState ( SOCKET s );
                    
40epicsShareFunc void epicsShareAPI 
                    
40epicsShareFunc void epicsShareAPI 
                    
41    epicsSocketEnableAddressUseForDatagramFanout ( SOCKET s );
                    
42
                    
183epicsShareFunc void epicsShareAPI osiSockDiscoverBroadcastAddresses
                    
184     (ELLLIST *pList, SOCKET socket, const osiSockAddr *pMatchAddr);
                    
185
                    
201 */
                    
202epicsShareFunc osiSockAddr epicsShareAPI osiLocalAddr (SOCKET socket);
                    
203
                    
                
LeaveWordSystem.cpp http://mmo-resourse.googlecode.com/svn/ | C++ | 318 lines
                    
53	msg.AddEx(&m_LeaveWordSetup, sizeof(tagLeaveWordSetup));
                    
54	msg.SendToSocket(GetGame()->GetDBSocketID());	
                    
55}
                    
92			msg.Add(SenderGuid);
                    
93			msg.SendToSocket(pSender->GetGsSocket());
                    
94			return FALSE;
                    
122	msg.Add(pWord);
                    
123	msg.SendToSocket(GetGame()->GetDBSocketID());
                    
124
                    
140		msg.Add(pReceiver->GetExID());
                    
141		msg.SendToSocket(GetGame()->GetDBSocketID());
                    
142	}
                    
155		pMsg->SetType(MSG_W2S_LEAVEWORD_POP);
                    
156		pMsg->SendToSocket(pPlayer->GetGsSocket());
                    
157	}
                    
                
raw_usrreq.c http://rtems-at91sam9g20ek.googlecode.com/svn/trunk/ | C | 308 lines
                    
46#include <sys/protosw.h>
                    
47#include <sys/socket.h>
                    
48#include <sys/socketvar.h>
                    
67/*
                    
68 * Raw protocol input routine.  Find the socket
                    
69 * associated with the packet(s) and move them over.  If
                    
80	register struct mbuf *m = m0;
                    
81	struct socket *last;
                    
82
                    
116		}
                    
117		last = rp->rcb_socket;
                    
118	}
                    
139int
                    
140raw_usrreq( struct socket *so, int req, struct mbuf *m, struct mbuf *nam,
                    
141    struct mbuf *control)
                    
                
function.c http://as3chat.googlecode.com/svn/trunk/ | C | 349 lines
                    
63
                    
64int evutil_make_socket_nonblocking(int fd) {
                    
65
                    
                
WinLIRC.ahk http://autohotkey-chinese.googlecode.com/svn/trunk/ | AutoHotkey | 281 lines
                    
154; This can connect to most types of TCP servers, not just WinLIRC.
                    
155; Returns -1 (INVALID_SOCKET) upon failure or the socket ID upon success.
                    
156{
                    
174	IPPROTO_TCP = 6
                    
175	socket := DllCall("Ws2_32\socket", "Int", AF_INET, "Int", SOCK_STREAM, "Int", IPPROTO_TCP)
                    
176	if socket = -1
                    
183	SizeOfSocketAddress = 16
                    
184	VarSetCapacity(SocketAddress, SizeOfSocketAddress)
                    
185	InsertInteger(2, SocketAddress, 0, AF_INET)   ; sin_family
                    
189	; Attempt connection:
                    
190	if DllCall("Ws2_32\connect", "UInt", socket, "UInt", &SocketAddress, "Int", SizeOfSocketAddress)
                    
191	{
                    
194	}
                    
195	return socket  ; Indicate success by returning a valid socket ID rather than -1.
                    
196}
                    
                
mailer.py https://bitbucket.org/clarifiednetworks/abusehelper/ | Python | 372 lines
                    
1import time
                    
2import socket
                    
3import getpass
                    
201class MailerService(ReportBot):
                    
202    TOLERATED_EXCEPTIONS = (socket.error, smtplib.SMTPException)
                    
203
                    
                
ghiper.c git://github.com/bagder/curl.git | C | 436 lines
                    
25 */
                    
26/* Example application source code using the multi socket interface to
                    
27 * download many files at once.
                    
105    case     CURLM_INTERNAL_ERROR:     s = "CURLM_INTERNAL_ERROR";     break;
                    
106    case     CURLM_BAD_SOCKET:         s = "CURLM_BAD_SOCKET";         break;
                    
107    case     CURLM_UNKNOWN_OPTION:     s = "CURLM_UNKNOWN_OPTION";     break;
                    
216/* Assign information to a SockInfo structure */
                    
217static void setsock(SockInfo *f, curl_socket_t s, CURL *e, int act,
                    
218                    GlobalInfo *g)
                    
233/* Initialize a new SockInfo structure */
                    
234static void addsock(curl_socket_t s, CURL *easy, int action, GlobalInfo *g)
                    
235{
                    
429
                    
430  /* we don't call any curl_multi_socket*() function yet as we have no handles
                    
431     added! */
                    
                
SOCK_Acceptor.cpp git://github.com/TrinityCore/TrinityCore.git | C++ | 407 lines
                    
7#include "ace/OS_NS_string.h"
                    
8#include "ace/OS_NS_sys_socket.h"
                    
9#include "ace/os_include/os_fcntl.h"
                    
93    // Reset the event association inherited by the new handle.
                    
94    ::WSAEventSelect ((SOCKET) new_handle, 0, 0);
                    
95#else
                    
199      // Reset the size of the addr, which is only necessary for UNIX
                    
200      // domain sockets.
                    
201      if (new_stream.get_handle () != ACE_INVALID_HANDLE
                    
                
ipc.h https://code.google.com/p/singularity-gate/ | C Header | 368 lines
                    
18    The actual DDE-based implementation using wxDDEConnection is available on
                    
19    Windows only, but a platform-independent, socket-based version of this API is
                    
20    available using wxTCPConnection, which has the same API.
                    
241    The actual DDE-based implementation using wxDDEClient is available on Windows
                    
242    only, but a platform-independent, socket-based version of this API is available
                    
243    using wxTCPClient, which has the same API.
                    
276        Under Unix, the service name may be either an integer port
                    
277        identifier in which case an Internet domain socket will be used
                    
278        for the communications, or a valid file name (which shouldn't
                    
279        exist and will be deleted afterwards) in which case a Unix domain
                    
280        socket is created.
                    
281
                    
281
                    
282        @note Using Internet domain sockets is extremely insecure for IPC as
                    
283              there is absolutely no access control for them, use Unix domain
                    
                
ClientProtocol0809.h http://pokerplus.googlecode.com/svn/trunk/ | C Header | 337 lines
                    
124
                    
125//?? = [socket readInt];
                    
126typedef struct
                    
                
OCPProtocol.java https://code.google.com/p/ocp/ | Java | 265 lines
                    
8import java.io.Serializable;
                    
9import java.net.Socket;
                    
10import java.util.Iterator;
                    
56	@Override
                    
57	public void process(Socket clientSocket) throws Exception {
                    
58		DataInputStream in = new DataInputStream(clientSocket.getInputStream());
                    
58		DataInputStream in = new DataInputStream(clientSocket.getInputStream());
                    
59		DataOutputStream out = new DataOutputStream(clientSocket.getOutputStream());
                    
60		JLG.debug("about to read object");
                    
63			InputMessage inputMessage = (InputMessage) o;
                    
64			Session session = new Session(ds(), clientSocket);
                    
65			JLG.debug("inputMessage.transid=" + inputMessage.transid);
                    
80
                    
81	public byte[] oldprocess(byte[] input, Socket clientSocket) throws Exception {
                    
82		getAgent();
                    
                
AddressDiagnosticsKit.java http://gophone.googlecode.com/svn/trunk/ | Java | 387 lines
                    
207            {
                    
208                if (ex.getCause() instanceof SocketException
                    
209                    && i < bindRetries)
                    
                
scale.c http://ftk.googlecode.com/svn/trunk/ | C | 417 lines
                    
46#include <pwd.h>
                    
47#ifdef LIBVNCSERVER_HAVE_SYS_SOCKET_H
                    
48#include <sys/socket.h>
                    
                
overview-tree.html http://jmxtrans.googlecode.com/svn/trunk/ | HTML | 176 lines
                    
94<UL>
                    
95<LI TYPE="circle">com.googlecode.jmxtrans.util.<A HREF="com/googlecode/jmxtrans/util/DatagramSocketFactory.html" title="class in com.googlecode.jmxtrans.util"><B>DatagramSocketFactory</B></A><LI TYPE="circle">com.googlecode.jmxtrans.util.<A HREF="com/googlecode/jmxtrans/util/JmxConnectionFactory.html" title="class in com.googlecode.jmxtrans.util"><B>JmxConnectionFactory</B></A><LI TYPE="circle">com.googlecode.jmxtrans.util.<A HREF="com/googlecode/jmxtrans/util/SocketFactory.html" title="class in com.googlecode.jmxtrans.util"><B>SocketFactory</B></A></UL>
                    
96<LI TYPE="circle">com.googlecode.jmxtrans.util.<A HREF="com/googlecode/jmxtrans/util/BaseOutputWriter.html" title="class in com.googlecode.jmxtrans.util"><B>BaseOutputWriter</B></A> (implements com.googlecode.jmxtrans.<A HREF="com/googlecode/jmxtrans/OutputWriter.html" title="interface in com.googlecode.jmxtrans">OutputWriter</A>)
                    
                
TCPServer.h http://mingw-lib.googlecode.com/svn/trunk/ | C++ Header | 201 lines
                    
64	/// an address before it is passed to the TCPServer constructor.
                    
65	/// Additionally, the ServerSocket must be put into listening
                    
66	/// state before the TCPServer is started by calling the start()
                    
100public:
                    
101	TCPServer(TCPServerConnectionFactory::Ptr pFactory, const ServerSocket& socket, TCPServerParams::Ptr pParams = 0);
                    
102		/// Creates the TCPServer, using the given ServerSocket.
                    
112
                    
113	TCPServer(TCPServerConnectionFactory::Ptr pFactory, Poco::ThreadPool& threadPool, const ServerSocket& socket, TCPServerParams::Ptr pParams = 0);
                    
114		/// Creates the TCPServer, using the given ServerSocket.
                    
175
                    
176	static std::string threadName(const ServerSocket& socket);
                    
177		/// Returns a thread name for the server thread.
                    
183	
                    
184	ServerSocket         _socket;
                    
185	TCPServerDispatcher* _pDispatcher;
                    
                
media_shout.erl git://github.com/2600hz/whistle.git | Erlang | 370 lines
                    
29	  ,media_id = <<>> :: binary()
                    
30	  ,lsocket = undefined :: undefined | port()
                    
31	  ,db = <<>> :: binary()
                    
136handle_info(timeout, #state{db=Db, doc=Doc, attachment=Attachment, media_name=MediaName, content_type=CType
                    
137			    ,lsocket=LSocket, send_to=SendTo, stream_type=StreamType}=S) ->
                    
138    {ok, PortNo} = inet:port(LSocket),
                    
156					    Self = self(),
                    
157					    spawn(fun() -> put(callid, CallID), start_shout_acceptor(Self, LSocket) end),
                    
158					    Url = list_to_binary(["shout://", net_adm:localhost(), ":", integer_to_list(PortNo), "/stream.mp3"]),
                    
203    ok = gen_tcp:controlling_process(Socket, MediaLoop),
                    
204    MediaLoop ! {add_socket, Socket},
                    
205    {noreply, S#state{media_loop = MediaLoop}, hibernate};
                    
207    ok = gen_tcp:controlling_process(Socket, MediaLoop),
                    
208    MediaLoop ! {add_socket, Socket},
                    
209    {noreply, S};
                    
                
test__examples.py https://code.google.com/p/gevent/ | Python | 280 lines
                    
13import gevent
                    
14from gevent import socket
                    
15import mysubprocess as subprocess
                    
106
                    
107if hasattr(socket, 'ssl'):
                    
108
                    
176        def test_client(message):
                    
177            conn = socket.create_connection(('127.0.0.1', 6000)).makefile(bufsize=1)
                    
178            welcome = conn.readline()
                    
183            conn._sock.settimeout(0.1)
                    
184            self.assertRaises(socket.timeout, conn.read, 1)
                    
185        client1 = gevent.spawn(test_client, 'hello\r\n')
                    
212        address = ('localhost', 9000)
                    
213        sock = socket.socket(type=socket.SOCK_DGRAM)
                    
214        sock.connect(address)
                    
                
os_socket.h git://github.com/insider42/mangos.git | C Header | 307 lines
                    
4/**
                    
5 *  @file    os_socket.h
                    
6 *
                    
6 *
                    
7 *  main sockets header
                    
8 *
                    
8 *
                    
9 *  $Id: os_socket.h 85015 2009-04-03 12:27:59Z johnnyw $
                    
10 *
                    
15
                    
16#ifndef ACE_OS_INCLUDE_SYS_OS_SOCKET_H
                    
17#define ACE_OS_INCLUDE_SYS_OS_SOCKET_H
                    
28
                    
29#if !defined (ACE_LACKS_SYS_SOCKET_H)
                    
30#  include /**/ <sys/socket.h>
                    
                
syscall_linux_386.go https://code.google.com/p/go/ | Go | 346 lines
                    
171
                    
172func socketcall(call int, a0, a1, a2, a3, a4, a5 uintptr) (n int, err Errno)
                    
173func rawsocketcall(call int, a0, a1, a2, a3, a4, a5 uintptr) (n int, err Errno)
                    
207func socketpair(domain int, typ int, flags int, fd *[2]int32) (err error) {
                    
208	_, e := rawsocketcall(_SOCKETPAIR, uintptr(domain), uintptr(typ), uintptr(flags), uintptr(unsafe.Pointer(fd)), 0, 0)
                    
209	if e != 0 {
                    
215func bind(s int, addr uintptr, addrlen _Socklen) (err error) {
                    
216	_, e := socketcall(_BIND, uintptr(s), uintptr(addr), uintptr(addrlen), 0, 0, 0)
                    
217	if e != 0 {
                    
223func connect(s int, addr uintptr, addrlen _Socklen) (err error) {
                    
224	_, e := socketcall(_CONNECT, uintptr(s), uintptr(addr), uintptr(addrlen), 0, 0, 0)
                    
225	if e != 0 {
                    
231func socket(domain int, typ int, proto int) (fd int, err error) {
                    
232	fd, e := rawsocketcall(_SOCKET, uintptr(domain), uintptr(typ), uintptr(proto), 0, 0, 0)
                    
233	if e != 0 {
                    
                
HampiServer.java http://hampi.googlecode.com/svn/trunk/ | Java | 409 lines
                    
24    int port = Integer.parseInt(args[0]);
                    
25    ServerSocket serverSocket = new ServerSocket(port, 1, InetAddress.getByName("localhost"));
                    
26    System.err.println(new Date() + " started Hampi server on port " + port);
                    
38      // a "blocking" call which waits until a connection is requested
                    
39      Socket clientSocket = serverSocket.accept();
                    
40      System.out.println(new Date() + " accepted connection");
                    
96 * <i>Input</i>. This class provides methods for reading strings and numbers
                    
97 * from standard input, file input, URL, and socket.
                    
98 * <p>
                    
131   */
                    
132  public In(Socket socket){
                    
133    try{
                    
312  // for Socket output
                    
313  public Out(Socket socket){
                    
314    try{
                    
                
bfpy.bftransport.BfTransportSocketError-class.html https://code.google.com/p/bfpy/ | HTML | 265 lines
                    
5<head>
                    
6  <title>bfpy.bftransport.BfTransportSocketError</title>
                    
7  <link rel="stylesheet" href="epydoc.css" type="text/css" />
                    
46        <a href="bfpy.bftransport-module.html">Module&nbsp;bftransport</a> ::
                    
47        Class&nbsp;BfTransportSocketError
                    
48      </span>
                    
56            >[<a href="frames.html" target="_top">frames</a
                    
57            >]&nbsp;|&nbsp;<a href="bfpy.bftransport.BfTransportSocketError-class.html"
                    
58            target="_top">no&nbsp;frames</a>]</span></td></tr>
                    
63<!-- ==================== CLASS DESCRIPTION ==================== -->
                    
64<h1 class="epydoc">Class BfTransportSocketError</h1><p class="nomargin-top"><span class="codelink"><a href="bfpy.bftransport-pysrc.html#BfTransportSocketError">source&nbsp;code</a></span></p>
                    
65<pre class="base-tree">
                    
73                                   |
                    
74                                  <strong class="uidshort">BfTransportSocketError</strong>
                    
75</pre>
                    
                
ColumnFamilyRecordWriter.java git://github.com/apache/cassandra.git | Java | 347 lines
                    
37import org.apache.thrift.TException;
                    
38import org.apache.thrift.transport.TSocket;
                    
39
                    
201        private Cassandra.Client thriftClient;
                    
202        private TSocket thriftSocket;
                    
203
                    
254        {
                    
255            if (thriftSocket != null)
                    
256            {
                    
256            {
                    
257                thriftSocket.close();
                    
258                thriftSocket = null;
                    
321                        InetAddress address = iter.next();
                    
322                        thriftSocket = new TSocket(address.getHostName(), ConfigHelper.getOutputRpcPort(conf));
                    
323                        thriftClient = ColumnFamilyOutputFormat.createAuthenticatedClient(thriftSocket, conf);
                    
                
antlr3input.h http://perseph.googlecode.com/svn/trunk/ | C Header | 224 lines
                    
57     *  Mostly this is just what is left in the pre-read buffer, but if the
                    
58     *  input source is a stream such as a socket or something then we may
                    
59     *  call special read code to wait for more input.
                    
                
MWReveal.java http://magicwars.googlecode.com/svn/trunk/ | Java | 358 lines
                    
33import mw.server.model.bean.CardBean;
                    
34import mw.server.socket.ZippedObjectImpl;
                    
35
                    
                
README.markdown git://github.com/nicolasff/webdis.git | Markdown | 356 lines
                    
63* Multi-threaded server, configurable number of worker threads.
                    
64* WebSocket support (Currently using the “hixie-76” specification).
                    
65* Connects to Redis using a TCP or UNIX socket.
                    
299# WebSockets
                    
300Webdis supports WebSocket clients implementing [dixie-76](http://tools.ietf.org/html/draft-hixie-thewebsocketprotocol-76).  
                    
301Web Sockets are supported with the following formats, selected by the connection URL:
                    
308function testJSON() {
                    
309	var jsonSocket = new WebSocket("ws://127.0.0.1:7379/.json");
                    
310	jsonSocket.onopen = function() {
                    
311
                    
312		console.log("JSON socket connected!");
                    
313		jsonSocket.send(JSON.stringify(["SET", "hello", "world"]));
                    
313		jsonSocket.send(JSON.stringify(["SET", "hello", "world"]));
                    
314		jsonSocket.send(JSON.stringify(["GET", "hello"]));
                    
315	};
                    
                
ipc_protocol2.h http://y-la-morocha-tambien.googlecode.com/svn/trunk/ | C Header | 121 lines
                    
68	t_ipc_pkg 				*ipcpkg2_create2(e_ipc_pkg_type type, void* payload, int lenght);
                    
69	t_ipc_pkg				*ipcpkg2_createFromBuffer1(char descId[], e_ipc_pkg_type type, t_socket_sbuffer* buffer);
                    
70	t_ipc_pkg				*ipcpkg2_createFromBuffer2(e_ipc_pkg_type type, t_socket_sbuffer* buffer);
                    
81	void			 		*ipcpkg2_getPayload(t_ipc_pkg *pkg);
                    
82	void 					ipcpkg2_getPayloadInBuffer1(t_ipc_pkg *pkg, t_socket_sbuffer *buffer);
                    
83	t_socket_sbuffer 		*ipcpkg2_getPayloadInBuffer2(t_ipc_pkg *pkg);
                    
89
                    
90	t_socket_sbuffer		*ipcpkg2_serializer(t_ipc_pkg *pkg);
                    
91	t_ipc_pkg				*ipcpkg2_deserializer(t_socket_sbuffer *buffer);
                    
97														  e_ipc_handshake_state  (*onAccept)(void *context, int process_id, t_socket_client*));
                    
98	t_socket_client			*ipcprotocol2_accepthandshake3(t_socket_server *server);
                    
99	t_socket_client			*ipcprotocol2_accepthandshake4(t_socket_server *server,
                    
117												void (*onResponse)(void *context, t_socket_client*, t_ipc_pkg*),
                    
118												int (*onClose)(void *context, t_socket_client*));
                    
119
                    
                
IdRemoteCMDClient.pas https://code.google.com/p/xseus/ | Pascal | 224 lines
                    
89uses
                    
90  IdComponent, IdGlobal, IdIOHandlerStack, IdIOHandlerSocket,IdSimpleServer, IdTCPConnection, IdThread, SysUtils;
                    
91
                    
144  end;
                    
145  if Socket = nil then begin
                    
146    IOHandler := TIdIOHandlerStack.Create(Self);
                    
154      try
                    
155        StdErr.BoundIP := Socket.Binding.IP;
                    
156        StdErr.BoundPortMin := BoundPortMin;
                    
                
sys_oabi-compat.c git://github.com/torvalds/linux.git | C | 467 lines
                    
64 * sys_sendto:
                    
65 * sys_socketcall:
                    
66 *
                    
79#include <linux/sem.h>
                    
80#include <linux/socket.h>
                    
81#include <linux/net.h>
                    
439
                    
440asmlinkage long sys_oabi_socketcall(int call, unsigned long __user *args)
                    
441{
                    
462	default:
                    
463		r = sys_socketcall(call, args);
                    
464	}
                    
                
socket.cpp http://es-operating-system.googlecode.com/svn/trunk/ | C++ | 803 lines
                    
205
                    
206    SocketMessenger m(this, &SocketReceiver::atMark);
                    
207
                    
657    }
                    
658    SocketMessenger m(this, &SocketReceiver::isReadable);
                    
659    Visitor v(&m);
                    
670    }
                    
671    SocketMessenger m(this, &SocketReceiver::isWritable);
                    
672    Visitor v(&m);
                    
720
                    
721    SocketMessenger m(this, &SocketReceiver::notify);
                    
722    Visitor v(&m);
                    
773    }
                    
774    else if (strcmp(riid, es::MulticastSocket::iid()) == 0 && type == es::Socket::Datagram)
                    
775    {
                    
                
HdfsBroker.java http://hypertable.googlecode.com/svn/trunk/ | Java | 547 lines
                    
25import java.io.IOException;
                    
26import java.net.InetSocketAddress;
                    
27import java.nio.BufferUnderflowException;
                    
                
LoggerManager.as http://log5f.googlecode.com/svn/ | ActionScript | 325 lines
                    
14    import org.log5f.appenders.TraceAppender;
                    
15    import org.log5f.appenders.XMLSocketAppender;
                    
16    import org.log5f.appenders.XPanelAppender;
                    
319			LoggerManager.forceCompile(FirebugAppender);
                    
320			LoggerManager.forceCompile(XMLSocketAppender);
                    
321			LoggerManager.forceCompile(ArthropodAppender);
                    
                
UDPWinshoe.pas https://code.google.com/p/moops-client/ | Pascal | 321 lines
                    
120
                    
121	AllocateSocket(SOCK_DGRAM); try
                    
122    with fAddr_Remote do begin
                    
184   , i);
                    
185 	CheckForSocketError(iByteCount);
                    
186  if iByteCount = 0 then begin
                    
213      CheckUDPBuffer;
                    
214      AllocateSocket(SOCK_DGRAM);
                    
215      Bind;
                    
247    raise Exception.Create('0 bytes were sent.')
                    
248  end else if iBytesOut = SOCKET_ERROR then begin
                    
249    if WinsockInterface.WSAGetLastError() = WSAEMSGSIZE then
                    
251    else
                    
252      CheckForSocketError(SOCKET_ERROR);
                    
253  end else if iBytesOut <> Length(psData) then begin
                    
                
win32_eventmgr.c http://ldb.googlecode.com/svn/trunk/ | C | 293 lines
                    
73/* set recv data. */
                    
74void socket_recvdata (struct socketer *self, char *data, int len)
                    
75{
                    
193					{
                    
194						log_error("res:%d, %x socket recvlock:%d, sendlock:%d, fd:%d, ref:%d, len:%d, thread_id:%d, error:%d, connect:%d, deleted:%d", res, ((struct socketer *)s), (int)((struct socketer *)s)->recvlock, (int)((struct socketer *)s)->sendlock, ((struct socketer *)s)->sockfd, (int)((struct socketer *)s)->ref, (int)len, CURRENT_THREAD, WSAGetLastError(), ((struct socketer *)s)->connected, ((struct socketer *)s)->deleted);
                    
195					}
                    
205					{
                    
206						log_error("res:%d, %x socket recvlock:%d, sendlock:%d, fd:%d, ref:%d, len:%d, thread_id:%d, error:%d, connect:%d, deleted:%d", res, ((struct socketer *)s), (int)((struct socketer *)s)->recvlock, (int)((struct socketer *)s)->sendlock, ((struct socketer *)s)->sockfd, (int)((struct socketer *)s)->ref, (int)len, CURRENT_THREAD, WSAGetLastError(), ((struct socketer *)s)->connected, ((struct socketer *)s)->deleted);
                    
207					}
                    
231 * initialize event manager. 
                    
232 * socketnum --- socket total number. must greater than 1.
                    
233 * threadnum --- thread number, if less than 0, then start by the number of cpu threads 
                    
277		cs = (struct overlappedstruct *)malloc(sizeof(struct overlappedstruct));
                    
278		sock = (struct socketer *)malloc(sizeof(struct socketer));
                    
279		cs->m_event = e_socket_io_thread_shutdown;
                    
                
Stomp.as http://as3-stomp.googlecode.com/svn/trunk/ | ActionScript | 490 lines
                    
50		
                    
51    	private var socket : Socket;
                    
52 		
                    
70	
                    
71		public function connect( server : String = "localhost", port : int = 61613, connectHeaders : ConnectHeaders = null, socket: Socket = null) : void 
                    
72		{
                    
75			this.connectHeaders = connectHeaders;
                    
76			this.socket = socket || new Socket();
                    
77			
                    
110	  		socket.addEventListener( Event.CLOSE, onClose );
                    
111      		socket.addEventListener( ProgressEvent.SOCKET_DATA, onData );
                    
112			socket.addEventListener( IOErrorEvent.IO_ERROR, onError );
                    
310	    		buffer.length = 0;
                    
311	    	socket.readBytes(buffer, buffer.length, socket.bytesAvailable);
                    
312	    	while (buffer.bytesAvailable > 0 && processFrame()) {
                    
                
edit_destination.cgi git://github.com/webmin/webmin.git | Perl | 174 lines
                    
119
                    
120# TCP or UDP socket
                    
121$net = $tcp || $udp;
                    
141
                    
142# Datagram or stream socket
                    
143$unix = $dgram || $stream;
                    
153	   "</td> </tr>\n";
                    
154$dtable .= "<tr> <td>$text{'destination_socket'}</td> ".
                    
155	   "<td>".&ui_textbox("unix_name", $unix_name, 30)."\n".
                    
                
 

Source

Language