PageRenderTime 232ms queryTime 60ms sortTime 3ms getByIdsTime 45ms findMatchingLines 20ms

100+ results results for 'socket repo:jiewenli/nodejs-c4' (232 ms)

Not the results you expected?
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;
                    
                
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
                    
                
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
                    
                
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)
                    
                
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	}
                    
                
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
                    
                
CnxManagerTest.java git://github.com/mesos/mesos.git | Java | 0 lines
                    
21import java.io.File;
                    
22import java.net.InetSocketAddress;
                    
23import java.nio.ByteBuffer;
                    
69                    new QuorumServer(i,
                    
70                            new InetSocketAddress(clientport),
                    
71                    new InetSocketAddress(PortAssignment.unique())));
                    
                
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;
                    
                
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>
                    
                
netlobby.h git://github.com/Warzone2100/warzone2100.git | C Header | 0 lines
                    
28#if defined(NO_SSL)
                    
29#include <QtNetwork/QTcpSocket>
                    
30#else
                    
30#else
                    
31#include <QtNetwork/QSslSocket>
                    
32#endif
                    
55
                    
56    // Copied from XMLRPC for socketrpc
                    
57    PARSE_ERROR             =   -32700,
                    
224#if defined(NO_SSL)
                    
225    QTcpSocket *socket_;
                    
226#else
                    
226#else
                    
227    QSslSocket *socket_;
                    
228#endif
                    
                
os.c https://bitbucket.org/ericvh/hare/ | C | 648 lines
                    
23
                    
24#include 	<sys/socket.h>
                    
25#include	<sched.h>
                    
                
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>
                    
                
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
                    
                
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
                    
                
tcpip_vtypes.py http://volatility.googlecode.com/svn/trunk/ | Python | 332 lines
                    
20
                    
21# Structures used by connections, connscan, sockets, sockscan.
                    
22# Used by x86 XP (all service packs) and x86 2003 SP0. 
                    
41
                    
42# Structures used by connections, connscan, sockets, sockscan.
                    
43# Used by x64 XP and x64 2003 (all service packs). 
                    
62
                    
63# Structures used by sockets and sockscan.
                    
64# Used by x86 2003 SP1 and SP2 only. 
                    
                
OnlineTest.php git://github.com/zendframework/zf2.git | PHP | 378 lines
                    
40    /**
                    
41     * Socket based HTTP client adapter
                    
42     *
                    
42     *
                    
43     * @var Zend_Http_Client_Adapter_Socket
                    
44     */
                    
44     */
                    
45    protected $_httpClientAdapterSocket;
                    
46
                    
59
                    
60        $this->_httpClientAdapterSocket = new Zend_Http_Client_Adapter_Socket();
                    
61
                    
63                      ->getHttpClient()
                    
64                      ->setAdapter($this->_httpClientAdapterSocket);
                    
65    }
                    
                
net.cpp http://gamekit.googlecode.com/svn/trunk/ | C++ | 421 lines
                    
33#define __STRICT_ANSI__
                    
34#include <sys/socket.h>
                    
35#include <sys/types.h>
                    
397   serv_addr.sin_port = htons(m_BeaconPort);
                    
398   if( ( sockfd = socket(hp->h_addrtype, SOCK_STREAM, 0)) < 0)
                    
399   {
                    
399   {
                    
400      //  sys_error("cannot create socket for gw");
                    
401      return;
                    
                
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    {
                    
                
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));
                    
                
misultin_websocket.erl git://github.com/ostinelli/misultin.git | Erlang | 279 lines
                    
107% Close socket and custom handling loop dependency
                    
108-spec websocket_close(Socket::socket(), WsHandleLoopPid::pid(), SocketMode::socketmode(), WsAutoExit::boolean()) -> ok.
                    
109websocket_close(Socket, WsHandleLoopPid, SocketMode, WsAutoExit) ->
                    
173-spec ws_loop(WsHandleLoopPid::pid(), SessionsRef::pid(), Ws::#ws{}, State::term()) -> ok.
                    
174ws_loop(WsHandleLoopPid, SessionsRef, #ws{vsn = Vsn, socket = Socket, socket_mode = SocketMode, ws_autoexit = WsAutoExit} = Ws, State) ->
                    
175	misultin_socket:setopts(Socket, [{active, once}], SocketMode),
                    
261-spec handle_data_receive(SessionsRef::pid(), WsHandleLoopPid::pid(), Data::binary(), Ws::#ws{}, State::term()) -> ok.
                    
262handle_data_receive(SessionsRef, WsHandleLoopPid, Data, #ws{vsn = Vsn, socket = Socket, socket_mode = SocketMode, ws_autoexit = WsAutoExit} = Ws, State) ->
                    
263	VsnMod = get_module_name_from_vsn(Vsn),
                    
265		websocket_close ->
                    
266			misultin_websocket:websocket_close(Socket, WsHandleLoopPid, SocketMode, WsAutoExit);
                    
267		{websocket_close, CloseData} ->
                    
268			misultin_socket:send(Socket, CloseData, SocketMode),
                    
269			misultin_websocket:websocket_close(Socket, WsHandleLoopPid, SocketMode, WsAutoExit);
                    
270		NewState ->
                    
                
ServerClient.cs https://bitbucket.org/VoiDeD/steamre/ | C# | 205 lines
                    
8using System.Net;
                    
9using System.Net.Sockets;
                    
10using System.Text;
                    
86        /// <value>The socket.</value>
                    
87        internal TcpSocket Socket { get; private set; }
                    
88        /// <summary>
                    
99        {
                    
100            get { return Socket.IsConnected; }
                    
101        }
                    
109            get { return Socket.ConnectionTimeout; }
                    
110            set { Socket.ConnectionTimeout = value; }
                    
111        }
                    
118        {
                    
119            Socket = new TcpSocket();
                    
120        }
                    
                
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
                    
                
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
                    
                
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  }
                    
                
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	}
                    
                
sml_RemoteConnection.cpp http://soar.googlecode.com/svn/trunk/SoarSuite/ | C++ | 396 lines
                    
8//
                    
9// This class represents a logical connection between two entities that are communicating via SML over a socket.
                    
10// For example, an environment (the client) and the Soar kernel.
                    
19#include "sml_RemoteConnection.h"
                    
20#include "sock_Socket.h"
                    
21#include "thread_Thread.h"
                    
155* For an remote connection this is done by sending the command
                    
156* over a socket as an actual XML string.
                    
157*
                    
158* There is no immediate response because we have to wait for
                    
159* the other side to read from the socket and execute the command.
                    
160* To get a response call GetResponseForID()
                    
187	{
                    
188		//sml::PrintDebug("Socket has closed down abruptly (during send), so we'll close the connection") ;
                    
189		SetError(Error::kSocketError) ;
                    
                
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};
                    
                
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.
                    
                
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);
                    
                
MessagingWebSocket.java http://unitt.googlecode.com/svn/projects/ | Java | 281 lines
                    
38
                    
39    public MessagingWebSocket( String aServerId, MessageSerializerRegistry aSerializers, long aQueueTimeoutInMillis, ServerWebSocket aServerWebSocket )
                    
40    {
                    
43
                    
44    public MessagingWebSocket( String aServerId, MessageSerializerRegistry aSerializers, long aQueueTimeoutInMillis, ServerWebSocket aServerWebSocket, String aSocketId )
                    
45    {
                    
120
                    
121    public void setSocketId( String aSocketId )
                    
122    {
                    
170
                    
171    public void setServerWebSocket( ServerWebSocket aServerWebSocket )
                    
172    {
                    
236            header.setSerializerType( serializerType );
                    
237            header.setWebSocketId( getSocketId() );
                    
238            header.setServerId( getServerId() );
                    
                
test_xspec.py https://bitbucket.org/hpk42/execnet/ | Python | 245 lines
                    
13    def test_norm_attributes(self):
                    
14        spec = XSpec("socket=192.168.102.2:8888//python=c:/this/python2.5"
                    
15                     "//chdir=d:\hello")
                    
15                     "//chdir=d:\hello")
                    
16        assert spec.socket == "192.168.102.2:8888"
                    
17        assert spec.python == "c:/this/python2.5"
                    
23
                    
24        spec = XSpec("socket=192.168.102.2:8888//python=python2.5//nice=3")
                    
25        assert spec.socket == "192.168.102.2:8888"
                    
219    def test_socket(self, specsocket, makegateway):
                    
220        gw = makegateway("socket=%s//id=sock1" % specsocket.socket)
                    
221        rinfo = gw._rinfo()
                    
229    def test_socket_second(self, specsocket, makegateway):
                    
230        gw = makegateway("socket=%s//id=sock1" % specsocket.socket)
                    
231        gw2 = makegateway("socket=%s//id=sock1" % specsocket.socket)
                    
                
Server.hs git://github.com/snapframework/snap-server.git | Haskell | 312 lines
                    
37import           Data.Word                         (Word64)
                    
38import           Network.Socket                    (Socket, close)
                    
39import           Prelude                           (Bool (..), Eq (..), IO, Maybe (..), Monad (..), Show (..), String, const, flip, fst, id, mapM, mapM_, maybe, snd, unzip3, zip, ($), ($!), (++), (.))
                    
55import           Snap.Internal.Http.Server.Session (httpAcceptLoop, snapToServerHandler)
                    
56import qualified Snap.Internal.Http.Server.Socket  as Sock
                    
57import qualified Snap.Internal.Http.Server.TLS     as TLS
                    
102    let output = when (fromJust $ getVerbose conf) . hPutStrLn stderr
                    
103    (descrs, sockets, afuncs) <- unzip3 <$> listeners conf
                    
104    mapM_ (output . ("Listening on " ++) . S.unpack) descrs
                    
105
                    
106    go conf sockets afuncs `finally` (mask_ $ do
                    
107        output "\nShutting down.."
                    
176    mkStartupInfo sockets conf =
                    
177        setStartupSockets sockets $
                    
178        setStartupConfig conf emptyStartupInfo
                    
                
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);
                    
                
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(
                    
                
client.py git://github.com/apenwarr/bup.git | Python | 347 lines
                    
80            elif self.protocol == 'bup':
                    
81                self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
                    
82                self.sock.connect((self.host, atoi(self.port) or 1982))
                    
109            self.sockw.close()
                    
110            self.sock.shutdown(socket.SHUT_WR)
                    
111        if self.conn:
                    
290        self.file = conn
                    
291        self.filename = 'remote socket'
                    
292        self.suggest_packs = suggest_packs
                    
                
nr_in.c git://github.com/torvalds/linux.git | C | 302 lines
                    
8#include <linux/types.h>
                    
9#include <linux/socket.h>
                    
10#include <linux/in.h>
                    
                
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    }
                    
                
socket.rb git://github.com/tarcieri/cool.io.git | Ruby | 233 lines
                    
59      def initialize(coolio_socket, ruby_socket)
                    
60        @coolio_socket, @ruby_socket = coolio_socket, ruby_socket
                    
61        super(ruby_socket, :w)
                    
71          @ruby_socket.setsockopt(::Socket::IPPROTO_TCP, ::Socket::TCP_NODELAY, [1].pack("l"))
                    
72          @ruby_socket.setsockopt(::Socket::SOL_SOCKET, ::Socket::SO_KEEPALIVE, true)
                    
73
                    
85      def connect_successful?
                    
86        @ruby_socket.getsockopt(::Socket::SOL_SOCKET, ::Socket::SO_ERROR).unpack('i').first == 0
                    
87      rescue IOError
                    
142    def initialize(socket)
                    
143      unless socket.is_a?(::TCPSocket) or socket.is_a?(TCPConnectSocket)
                    
144        raise TypeError, "socket must be a TCPSocket"
                    
226    def initialize(socket)
                    
227      raise ArgumentError, "socket must be a UNIXSocket" unless socket.is_a? ::UNIXSocket
                    
228
                    
                
HttpClient2.as http://cmisspaces.googlecode.com/svn/trunk/ | ActionScript | 278 lines
                    
50	 * Extends HttpClient in as3httpclientlib to support URLLoader, HttpService requests
                    
51	 * in addition to Socket request support in HttpClient
                    
52	 * (note that URLLoader and HttpService requests have limitations in Flex
                    
                
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);
                    
                
Main.cs http://zero-k.googlecode.com/svn/trunk/ | C# | 309 lines
                    
6using System.Net;
                    
7using System.Net.Sockets;
                    
8using System.Timers;
                    
68                var freePort =
                    
69                    Enumerable.Range(Config.HostingPortStart + Config.RestartCounter * 100, Config.MaxInstances).FirstOrDefault(x => !usedPorts.ContainsKey(x) && VerifyUdpSocket(x));
                    
70                return freePort;
                    
225
                    
226        public static bool VerifyUdpSocket(int port)
                    
227        {
                    
229            {
                    
230                using (var sock = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp))
                    
231                {
                    
                
IConduit.d git://github.com/SiegeLord/Tango-D2.git | D | 329 lines
                    
20        expose a pair of streams, are modelled by tango.io.model.IConduit,
                    
21        and are implemented via classes such as File &amp; SocketConduit.
                    
22
                    
                
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.
                    
                
freeswitch.erl git://github.com/2600hz/whistle.git | Erlang | 387 lines
                    
241%% @doc Send an event to FreeSWITCH. `EventName' is the name of the event and
                    
242%% `Headers' is a list of `{Key, Value}' string tuples. See the mod_event_socket
                    
243%% documentation for more information.
                    
254%% subclass and `Headers' is a list of `{Key, Value}' string tuples. See the
                    
255%% mod_event_socket documentation for more information.
                    
256sendevent_custom(Node, SubClassName, Headers) ->
                    
                
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);
                    
                
all-index-D.html http://as3logger.googlecode.com/svn/trunk/ | HTML | 110 lines
                    
79<td width="20"></td><td>
                    
80   Disconnects from the socket.</td>
                    
81</tr>
                    
                
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	};
                    
                
config-win32.h git://github.com/zpao/spidernode.git | C Header | 360 lines
                    
86
                    
87/* Define if you have the closesocket function.  */
                    
88#define HAVE_CLOSESOCKET 1
                    
92
                    
93/* Define if you have the ioctlsocket function. */
                    
94#define HAVE_IOCTLSOCKET 1
                    
95
                    
96/* Define if you have a working ioctlsocket FIONBIO function. */
                    
97#define HAVE_IOCTLSOCKET_FIONBIO 1
                    
117/* Define to the type of arg 1 for recv. */
                    
118#define RECV_TYPE_ARG1 SOCKET
                    
119
                    
135/* Define to the type of arg 1 for recvfrom. */
                    
136#define RECVFROM_TYPE_ARG1 SOCKET
                    
137
                    
                
errors.lisp git://github.com/marijnh/Postmodern.git | Lisp | 184 lines
                    
57signal virtually all database-related errors \(though in some cases
                    
58socket errors may be raised when a connection fails on the IP
                    
59level)."))
                    
103  (:documentation "Conditions of this type are signalled when an error
                    
104occurs that breaks the connection socket. They offer a :reconnect
                    
105restart."))
                    
108connection object."))
                    
109(define-condition database-socket-error (database-connection-error) ()
                    
110  (:documentation "Used to wrap stream-errors and socket-errors,
                    
112
                    
113(defun wrap-socket-error (err)
                    
114  (make-instance 'database-socket-error
                    
                
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>
                    
                
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,
                    
                
mysql_adapter.rb git://github.com/rails/rails.git | Ruby | 423 lines
                    
26      port     = config[:port]
                    
27      socket   = config[:socket]
                    
28      username = config[:username] ? config[:username].to_s : 'root'
                    
36      default_flags |= Mysql::CLIENT_FOUND_ROWS if Mysql.const_defined?(:CLIENT_FOUND_ROWS)
                    
37      options = [host, username, password, database, port, socket, default_flags]
                    
38      ConnectionAdapters::MysqlAdapter.new(mysql, logger, options, config)
                    
49    # * <tt>:port</tt> - Defaults to 3306.
                    
50    # * <tt>:socket</tt> - Defaults to "/tmp/mysql.sock".
                    
51    # * <tt>:username</tt> - Defaults to "root"
                    
                
AbstractProtocol.php git://github.com/zendframework/zf2.git | PHP | 0 lines
                    
91     */
                    
92    protected $_socket;
                    
93
                    
259        // open connection
                    
260        $this->_socket = @stream_socket_client($remote, $errorNum, $errorStr, self::TIMEOUT_CONNECTION);
                    
261
                    
261
                    
262        if ($this->_socket === false) {
                    
263            if ($errorNum == 0) {
                    
268
                    
269        if (($result = stream_set_timeout($this->_socket, self::TIMEOUT_CONNECTION)) === false) {
                    
270            throw new Protocol\Exception\RuntimeException('Could not set stream timeout');
                    
284        if (is_resource($this->_socket)) {
                    
285            fclose($this->_socket);
                    
286        }
                    
                
ProxyRequestHandler.java http://google-enterprise-connector-sharepoint.googlecode.com/svn/trunk/ | Java | 166 lines
                    
97        try {
                    
98            proxyconn.setSocketTimeout(0);
                    
99            // Rewrite target url
                    
                
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>
                    
                
ocv_freenect.mm git://github.com/doug/depthjs.git | Objective C++ | 475 lines
                    
135void send_image(const Mat& img) {
                    
136  //  s_sendmore(socket, "image");
                    
137  //
                    
145  //
                    
146  //  s_send(socket, (const char*)_img.data);
                    
147}
                    
                
ItemListItem.cs https://Rawr.svn.codeplex.com/svn | C# | 183 lines
                    
136                        GemIcon = Icons.AnIcon(_calc.ItemInstance.Gem1.IconPath),
                    
137                        SocketBrush = GetBrushForSlot(_calc.ItemInstance.Item.SocketColor1)
                    
138                    });
                    
142                        GemIcon = Icons.AnIcon(_calc.ItemInstance.Gem2.IconPath),
                    
143                        SocketBrush = GetBrushForSlot(_calc.ItemInstance.Item.SocketColor2)
                    
144                    });
                    
148                        GemIcon = Icons.AnIcon(_calc.ItemInstance.Gem3.IconPath),
                    
149                        SocketBrush = GetBrushForSlot(_calc.ItemInstance.Item.SocketColor3)
                    
150                    });
                    
178            public ImageSource GemIcon { get; set; }
                    
179            public Brush SocketBrush { get; set; }
                    
180        }
                    
                
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    {
                    
                
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! */
                    
                
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
                    
                
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
                    
                
NetworkTunerServer.java http://customsagetv.googlecode.com/svn/trunk/ | Java | 226 lines
                    
38
                    
39    private ServerSocket          serversocket   = null;
                    
40    private DatagramSocket        datagramSocket = null;
                    
112        try {
                    
113            serversocket = new ServerSocket(config.getPort());
                    
114        } catch (Exception exception) {
                    
114        } catch (Exception exception) {
                    
115            logger.error("Error creating network tuner socket: " + config.getPort(), exception);
                    
116            return;
                    
123		            try {
                    
124		                Socket socket = serversocket.accept();
                    
125		                socket.setSoTimeout(15000);
                    
162                    try {
                    
163                        datagramSocket = new DatagramSocket(8271);
                    
164                    } catch (IOException ioexception) {
                    
                
RemoteX11AcceptThread.java https://code.google.com/p/sshtunnel/ | Java | 245 lines
                    
5import java.io.OutputStream;
                    
6import java.net.Socket;
                    
7
                    
25
                    
26	Socket s;
                    
27
                    
172
                    
173			s = new Socket(sd.hostname, sd.port);
                    
174
                    
                
curlbuild.h.in git://github.com/mono/moon.git | Autoconf | 191 lines
                    
148/* Configure process defines this to 1 when it finds out that system    */
                    
149/* header file sys/socket.h must be included by the external interface. */
                    
150#undef CURL_PULL_SYS_SOCKET_H
                    
150#undef CURL_PULL_SYS_SOCKET_H
                    
151#ifdef CURL_PULL_SYS_SOCKET_H
                    
152#  include <sys/socket.h>
                    
                
simple_thrift.rb git://github.com/nkallen/Rowz.git | Ruby | 257 lines
                    
7
                    
8require 'socket'
                    
9require 'getoptlong'
                    
                
config.h git://github.com/rhomobile/rhodes.git | C Header | 611 lines
                    
100#define HAVE_SYS_SELECT_H 1
                    
101#define HAVE_SYS_SOCKET_H 1
                    
102#define HAVE_SYS_SYSCALL_H 1
                    
                
thmsortslave.cpp git://github.com/hpcc-systems/HPCC-Platform.git | C++ | 231 lines
                    
49    Owned<IBarrier> barrier;
                    
50    SocketEndpoint server;
                    
51    CriticalSection statsCs;
                    
                
server.cpp https://bitbucket.org/vstakhov/icnqt | C++ | 264 lines
                    
178
                    
179    if (socket.write("\n\r", 2) < 0) {
                    
180		this->error = QString::fromUtf8("Невозможно подключиться к серверу: ошибка записи в сокет");
                    
184	/* Now read XML data */
                    
185	if (!socket.waitForReadyRead(timeout)) {
                    
186		this->error = QString::fromUtf8("Невозможно подключиться к серверу: истекло время ожидания ответа");
                    
216{
                    
217	socket.write (line, len);
                    
218	return parseReply ();
                    
227	socket.connectToHost (hostName, port);
                    
228	if (socket.waitForConnected(timeout) && socket.state () == QAbstractSocket::ConnectedState) {
                    
229		emit connected();
                    
248	socket.connectToHost (hostName, port);
                    
249	if (socket.waitForConnected(timeout) && socket.state () == QAbstractSocket::ConnectedState) {
                    
250		emit connected();
                    
                
client.html git://github.com/mauricemach/zappa.git | HTML | 82 lines
                    
29    <span class="nv">context.connect = </span><span class="o">-&gt;</span>
                    
30      <span class="nv">context.socket = </span><span class="nx">io</span><span class="p">.</span><span class="nx">connect</span><span class="p">.</span><span class="nx">apply</span> <span class="nx">io</span><span class="p">,</span> <span class="nx">arguments</span>
                    
31      
                    
33      <span class="k">if</span> <span class="k">typeof</span> <span class="nx">arguments</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">isnt</span> <span class="s1">&#39;object&#39;</span>
                    
34        <span class="nx">context</span><span class="p">.</span><span class="nx">socket</span><span class="p">.</span><span class="nx">emit</span><span class="p">.</span><span class="nx">apply</span> <span class="nx">context</span><span class="p">.</span><span class="nx">socket</span><span class="p">,</span> <span class="nx">arguments</span>
                    
35      <span class="k">else</span>
                    
36        <span class="k">for</span> <span class="nx">k</span><span class="p">,</span> <span class="nx">v</span> <span class="k">of</span> <span class="nx">arguments</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>
                    
37          <span class="nx">context</span><span class="p">.</span><span class="nx">socket</span><span class="p">.</span><span class="nx">emit</span><span class="p">.</span><span class="nx">apply</span> <span class="nx">context</span><span class="p">.</span><span class="nx">socket</span><span class="p">,</span> <span class="p">[</span><span class="nx">k</span><span class="p">,</span> <span class="nx">v</span><span class="p">]</span>
                    
38
                    
53          <span class="k">when</span> <span class="s1">&#39;param&#39;</span> <span class="k">then</span> <span class="nx">r</span><span class="p">.</span><span class="nx">handler</span><span class="p">.</span><span class="nx">apply</span><span class="p">(</span><span class="nx">ctx</span><span class="p">,</span> <span class="p">[</span><span class="nx">sammy_context</span><span class="p">.</span><span class="nx">params</span><span class="p">])</span>
                    
54          <span class="k">else</span> <span class="nx">r</span><span class="p">.</span><span class="nx">handler</span><span class="p">.</span><span class="nx">apply</span><span class="p">(</span><span class="nx">ctx</span><span class="p">,</span> <span class="p">[</span><span class="nx">ctx</span><span class="p">])</span></pre></div>             </td>           </tr>                               <tr id="section-3">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-3">&#182;</a>               </div>               <p>GO!!!</p>             </td>             <td class="code">               <div class="highlight"><pre>    <span class="nx">func</span><span class="p">.</span><span class="nx">apply</span><span class="p">(</span><span class="nx">context</span><span class="p">,</span> <span class="p">[</span><span class="nx">context</span><span class="p">])</span></pre></div>             </td>           </tr>                               <tr id="section-4">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-4">&#182;</a>               </div>               <p>Implements the websockets client with socket.io.</p>             </td>             <td class="code">               <div class="highlight"><pre>    <span class="k">if</span> <span class="nx">context</span><span class="p">.</span><span class="nx">socket</span><span class="o">?</span>
                    
55      <span class="k">for</span> <span class="nx">name</span><span class="p">,</span> <span class="nx">h</span> <span class="k">of</span> <span class="nx">ws_handlers</span>
                    
59              <span class="nv">app: </span><span class="nx">app</span>
                    
60              <span class="nv">socket: </span><span class="nx">context</span><span class="p">.</span><span class="nx">socket</span>
                    
61              <span class="nv">id: </span><span class="nx">context</span><span class="p">.</span><span class="nx">socket</span><span class="p">.</span><span class="nx">id</span>
                    
                
debugger.c git://github.com/bmeurer/ocaml.git | C | 439 lines
                    
85
                    
86static int dbg_socket = -1;     /* The socket connected to the debugger */
                    
87static struct channel * dbg_in; /* Input channel on the socket */
                    
99  oldvaluelen = sizeof(oldvalue);
                    
100  retcode = getsockopt(INVALID_SOCKET, SOL_SOCKET, SO_OPENTYPE,
                    
101                       (char *) &oldvalue, &oldvaluelen);
                    
107#endif
                    
108  dbg_socket = socket(sock_domain, SOCK_STREAM, 0);
                    
109#ifdef _WIN32
                    
111    /* Restore initial mode */
                    
112    setsockopt(INVALID_SOCKET, SOL_SOCKET, SO_OPENTYPE,
                    
113               (char *) &oldvalue, oldvaluelen);
                    
121#ifdef _WIN32
                    
122  dbg_socket = _open_osfhandle(dbg_socket, 0);
                    
123  if (dbg_socket == -1)
                    
                
ListenSocket.h https://bitbucket.org/oregon/oregoncore/ | C Header | 0 lines
                    
29*/
                    
30#ifndef _SOCKETS_ListenSocket_H
                    
31#define _SOCKETS_ListenSocket_H
                    
63        \param use_creator Optional use of creator (default true) */
                    
64    ListenSocket(ISocketHandler& h,bool use_creator = true) : Socket(h), m_depth(0), m_creator(NULL)
                    
65    ,m_bHasCreate(false)
                    
392        "accept()" is handled automatically in the OnRead() method. */
                    
393        virtual SOCKET Accept(SOCKET socket, struct sockaddr *saptr, socklen_t *lenptr)
                    
394        {
                    
404protected:
                    
405    ListenSocket(const ListenSocket& s) : Socket(s) {}
                    
406private:
                    
406private:
                    
407    ListenSocket& operator=(const ListenSocket& ) { return *this; }
                    
408    int m_depth;
                    
                
w.c https://bitbucket.org/freebsd/freebsd-head/ | C | 529 lines
                    
56#include <sys/ioctl.h>
                    
57#include <sys/socket.h>
                    
58#include <sys/tty.h>
                    
                
sys_procdesc.c https://bitbucket.org/freebsd/freebsd-head/ | C | 533 lines
                    
42 *   references to that descriptor may be held from many processes (or even
                    
43 *   be in flight between processes over a local domain socket).
                    
44 * - Last close on the process descriptor will terminate the process using
                    
                
hdldsvr.c https://bitbucket.org/ifcaro/open-ps2-loader/ | C | 502 lines
                    
288					if (r < 0) {
                    
289						reject_tcp_command(tcp_client_socket, "init_write_stat failed");
                    
290						goto error;
                    
400{
                    
401	int tcp_socket, client_socket = -1;
                    
402	struct sockaddr_in peer;
                    
412		// create the socket
                    
413		tcp_socket = lwip_socket(AF_INET, SOCK_STREAM, 0);
                    
414		if (tcp_socket < 0)
                    
429			// wait for incoming connection
                    
430			client_socket = lwip_accept(tcp_socket, (struct sockaddr *)&peer, &peerlen);
                    
431			if (client_socket < 0)
                    
460		// create the socket
                    
461		udp_socket = lwip_socket(AF_INET, SOCK_DGRAM, 0);
                    
462		if (udp_socket < 0)
                    
                
encoding.php https://bitbucket.org/chamilo/chamilo-dev/ | PHP | 631 lines
                    
403     * Writes no extra headers.
                    
404     * @param SimpleSocket $socket        Socket to write to.
                    
405     * @access public
                    
413     * the URL.
                    
414     * @param SimpleSocket $socket        Socket to write to.
                    
415     * @access public
                    
537     * Dispatches the form headers down the socket.
                    
538     * @param SimpleSocket $socket        Socket to write to.
                    
539     * @access public
                    
593     * Dispatches the form headers down the socket.
                    
594     * @param SimpleSocket $socket        Socket to write to.
                    
595     * @access public
                    
604     * Dispatches the form data down the socket.
                    
605     * @param SimpleSocket $socket        Socket to write to.
                    
606     * @access public
                    
                
Netcache.java https://code.google.com/p/waf/ | Java | 280 lines
                    
26	private final static HashMap<String, Object[]> flist = new HashMap<String, Object[]>();
                    
27	private Socket sock = null;
                    
28	private int port = 0;
                    
29
                    
30	public Netcache(Socket sock, int port) {
                    
31		this.sock = sock;
                    
74				// magic trick to avoid creating a new inner class
                    
75				ServerSocket server = new ServerSocket(port);
                    
76				server.setReuseAddress(true);
                    
                
BridgeTest.as git://github.com/benbjohnson/melomel.git | ActionScript | 217 lines
                    
108		bridge.connect();
                    
109		socket = (bridge as MockBridge).getSocket() as MockXMLSocket;
                    
110		Async.proceedOnEvent(this, socket, "send");
                    
146		bridge.connect();
                    
147		socket = (bridge as MockBridge).getSocket() as MockXMLSocket;
                    
148		Async.proceedOnEvent(this, socket, "send");
                    
165		bridge.connect();
                    
166		socket = (bridge as MockBridge).getSocket() as MockXMLSocket;
                    
167		Async.proceedOnEvent(this, socket, "send");
                    
180		bridge.connect();
                    
181		socket = (bridge as MockBridge).getSocket() as MockXMLSocket;
                    
182		Async.proceedOnEvent(this, socket, "send");
                    
199		bridge.connect();
                    
200		socket = (bridge as MockBridge).getSocket() as MockXMLSocket;
                    
201		Async.proceedOnEvent(this, socket, "send");
                    
                
run.py https://bitbucket.org/mirror/python-trunk/ | Python | 343 lines
                    
3import time
                    
4import socket
                    
5import traceback
                    
41# Thread shared globals: Establish a queue between a subthread (which handles
                    
42# the socket) and the main thread (which runs user code), plus global
                    
43# completion, exit and interruptable (the main thread) flags:
                    
53    MyHandler, which inherits register/unregister methods from RPCHandler via
                    
54    the mix-in class SocketIO.
                    
55
                    
62    (e.g. RemoteDebugger.Debugger.start_debugger()).  The latter, in turn, can
                    
63    call MyHandler(SocketIO) register/unregister methods via the reference to
                    
64    register and unregister themselves.
                    
78    sys.argv[:] = [""]
                    
79    sockthread = threading.Thread(target=manage_socket,
                    
80                                  name='SockThread',
                    
                
unix_socket_constants.h git://github.com/php/php-src.git | C Header | 422 lines
                    
16
                    
17/* This file is to be included by sockets.c */
                    
18
                    
20	/* Operation not permitted */
                    
21	REGISTER_LONG_CONSTANT("SOCKET_EPERM", EPERM, CONST_CS | CONST_PERSISTENT);
                    
22#endif
                    
24	/* No such file or directory */
                    
25	REGISTER_LONG_CONSTANT("SOCKET_ENOENT", ENOENT, CONST_CS | CONST_PERSISTENT);
                    
26#endif
                    
28	/* Interrupted system call */
                    
29	REGISTER_LONG_CONSTANT("SOCKET_EINTR", EINTR, CONST_CS | CONST_PERSISTENT);
                    
30#endif
                    
291#ifdef ENOTSOCK
                    
292	/* Socket operation on non-socket */
                    
293	REGISTER_LONG_CONSTANT("SOCKET_ENOTSOCK", ENOTSOCK, CONST_CS | CONST_PERSISTENT);
                    
                
ChannelManager.java http://jwebsocket.googlecode.com/svn/trunk/ | Java | 368 lines
                    
20
                    
21import org.jwebsocket.api.WebSocketConnector;
                    
22import org.jwebsocket.config.JWebSocketCommonConstants;
                    
23import org.jwebsocket.config.JWebSocketConfig;
                    
24import org.jwebsocket.config.JWebSocketServerConstants;
                    
25import org.jwebsocket.config.xml.ChannelConfig;
                    
89	 * Starts the system channels within the jWebSocket system configured via
                    
90	 * jWebSocket.xml, Note that it doesn't insert the system channels to the
                    
91	 * channel store.
                    
98		// TODO: Process if no root user could be found!
                    
99		JWebSocketConfig lConfig = JWebSocketConfig.getConfig();
                    
100		for (ChannelConfig lCfg : lConfig.getChannels()) {
                    
319
                    
320	public Token getChannelSuccessToken(WebSocketConnector aConnector, String aChannel, ChannelEventEnum aEventType) {
                    
321		Token lToken = getBaseChannelResponse(aConnector, aChannel);
                    
                
utils.rb git://github.com/ruby/ruby.git | Ruby | 397 lines
                    
33require "tempfile"
                    
34require "socket"
                    
35require "envutil"
                    
223
                    
224      Socket.do_not_reverse_lookup = true
                    
225      tcps = TCPServer.new("127.0.0.1", 0)
                    
                
nacl_desc_wrapper.h http://o3d.googlecode.com/svn/trunk/ | C Header | 214 lines
                    
23
                    
24  // Create a bound socket, socket address pair.
                    
25  int MakeBoundSock(DescWrapper* pair[2]);
                    
25  int MakeBoundSock(DescWrapper* pair[2]);
                    
26  // Create a pair of DescWrappers for a connnected (data-only) socket.
                    
27  int MakeSocketPair(DescWrapper* pair[2]);
                    
27  int MakeSocketPair(DescWrapper* pair[2]);
                    
28  // Create an IMC socket object.
                    
29  DescWrapper* MakeImcSock(NaClHandle handle);
                    
31  DescWrapper* MakeShm(size_t size);
                    
32  // Create a DescWrapper from a socket address string.
                    
33  DescWrapper* MakeSocketAddress(const char* addr);
                    
100  // Get the path string from a NaClDescConnCap.  Returns NULL if the
                    
101  // type of the NaClDesc is not NACL_DESC_CONN_CAP (a socket address).
                    
102  const char* conn_cap_path() const;
                    
                
tsc_sync.c git://github.com/torvalds/linux.git | C | 493 lines
                    
34/*
                    
35 * TSC's on different sockets may be reset asynchronously.
                    
36 * This may cause the TSC ADJUST value on socket 0 to be NOT 0.
                    
94	 * Also don't force the ADJUST value to zero if that is a valid value
                    
95	 * for socket 0 as determined by the system arch.  This is required
                    
96	 * when multiple sockets are reset asynchronously with each other
                    
96	 * when multiple sockets are reset asynchronously with each other
                    
97	 * and socket 0 may not have an TSC ADJUST value of 0.
                    
98	 */
                    
153	/*
                    
154	 * If a non-zero TSC value for socket 0 may be valid then the default
                    
155	 * adjusted value cannot assumed to be zero either.
                    
181	if (bootval != ref->bootval)
                    
182		printk_once(FW_BUG "TSC ADJUST differs within socket(s), fixing all errors\n");
                    
183
                    
                
Makefile.in http://qse.googlecode.com/svn/trunk/qse/ | Autoconf | 429 lines
                    
161SHELL = @SHELL@
                    
162SOCKET_LIBS = @SOCKET_LIBS@
                    
163SSL_LIBS = @SSL_LIBS@
                    
                
FtpClient.cs http://msnp-sharp.googlecode.com/svn/trunk/ | C# | 343 lines
                    
44	///<param name="Destroyer">The callback method to be called when this Client object disconnects from the local client and the remote server.</param>
                    
45	public FtpClient(Socket ClientSocket, DestroyDelegate Destroyer) : base(ClientSocket, Destroyer) {}
                    
46	///<summary>Sends a welcome message to the client.</summary>
                    
49			string ToSend = "220 Mentalis.org FTP proxy server ready.\r\n";
                    
50			ClientSocket.BeginSend(Encoding.ASCII.GetBytes(ToSend), 0, ToSend.Length, SocketFlags.None, new AsyncCallback(this.OnHelloSent), ClientSocket);
                    
51		} catch {
                    
81				if (ProcessCommand(Command))
                    
82					DestinationSocket.BeginSend(Encoding.ASCII.GetBytes(Command), 0, Command.Length, SocketFlags.None, new AsyncCallback(this.OnCommandSent), DestinationSocket);
                    
83				FtpCommand = "";
                    
207			} else {
                    
208				DestinationSocket.BeginReceive(RemoteBuffer, 0, RemoteBuffer.Length, SocketFlags.None, new AsyncCallback(this.OnIgnoreReply), DestinationSocket);
                    
209			}
                    
262	internal void SendCommand(string Command) {
                    
263		ClientSocket.BeginSend(Encoding.ASCII.GetBytes(Command), 0, Command.Length, SocketFlags.None, new AsyncCallback(this.OnReplySent), ClientSocket);
                    
264	}
                    
                
ConnectionListener.cs http://sharpmud-framework.googlecode.com/svn/trunk/ | C# | 199 lines
                    
2using System.Net;
                    
3using System.Net.Sockets;
                    
4
                    
10		private System.Collections.ArrayList		_WaitingConnections;
                    
11		private System.Net.Sockets.TcpListener		_TcpListener;
                    
12		private int									_Port;
                    
58			_WaitingConnections = new System.Collections.ArrayList();
                    
59			_TcpListener = new System.Net.Sockets.TcpListener(_Address, _Port);
                    
60			_Host = host;
                    
80		/// <summary>
                    
81		/// The list of connections that have had their sockets accepted and are awaiting to be handled
                    
82		/// </summary>
                    
155				{
                    
156					NetworkConnection cw = new NetworkConnection(_TcpListener.AcceptSocket());
                    
157
                    
                
guppi_udp.c git://github.com/david-macmahon/paper_gpu.git | C | 456 lines
                    
9#include <sys/types.h>
                    
10#include <sys/socket.h>
                    
11#include <netinet/in.h>
                    
39
                    
40    /* Set up socket */
                    
41    p->sock = socket(PF_INET, SOCK_DGRAM, 0);
                    
42    if (p->sock==-1) { 
                    
43        guppi_error("guppi_udp_init", "socket error");
                    
44        freeaddrinfo(result);
                    
58
                    
59    /* Set up socket to recv only from sender */
                    
60    for (rp=result; rp!=NULL; rp=rp->ai_next) {
                    
77    socklen_t ss = sizeof(int);
                    
78    rv = setsockopt(p->sock, SOL_SOCKET, SO_RCVBUF, &bufsize, sizeof(int));
                    
79    if (rv<0) { 
                    
                
rmtfile.hpp git://github.com/hpcc-systems/HPCC-Platform.git | C++ Header | 111 lines
                    
20
                    
21#include "jsocket.hpp"
                    
22#include "jfile.hpp"
                    
45    virtual void addRangeFilter(const char *range, const char *dir, const char *sourceRange, bool trace) = 0;
                    
46    virtual IPropertyTree *addFilters(IPropertyTree *filters, const SocketEndpoint *ipAddress) = 0;
                    
47    virtual IPropertyTree *addMyFilters(IPropertyTree *filters, SocketEndpoint *myEp=NULL) = 0;
                    
52extern REMOTE_API void setCanAccessDirectly(RemoteFilename & file,bool set);
                    
53extern REMOTE_API void setDaliServixSocketCaching(bool set);
                    
54extern REMOTE_API bool canAccessDirectly(const RemoteFilename & file);
                    
56extern REMOTE_API bool testDaliServixPresent(const IpAddress &ip);
                    
57extern REMOTE_API bool testDaliServixPresent(const SocketEndpoint &ep);
                    
58extern REMOTE_API unsigned getDaliServixVersion(const IpAddress &ip,StringBuffer &ver);
                    
104                                
                    
105extern REMOTE_API unsigned validateNodes(const SocketEndpointArray &eps,const char *dataDir, const char *mirrorDir, bool chkver, const char *script, unsigned scripttimeout, SocketEndpointArray &failures, UnsignedArray &failedcodes, StringArray &failedmessages, const char *filename=NULL);
                    
106
                    
                
test_httpservers.py https://IronPython.svn.codeplex.com/svn | Python | 355 lines
                    
38        self.server = HTTPServer(('', 0), self.request_handler)
                    
39        self.test_object.PORT = self.server.socket.getsockname()[1]
                    
40        self.test_object.lock.release()
                    
                
_ssl_test.py https://IronPython.svn.codeplex.com/svn | Python | 365 lines
                    
219    #sock
                    
220    s = socket.socket(socket.AF_INET)
                    
221    s.connect((SSL_URL, SSL_PORT))
                    
237    '''
                    
238    s = socket.socket(socket.AF_INET)
                    
239    s.connect((SSL_URL, SSL_PORT))
                    
266    #--Positive
                    
267    s = socket.socket(socket.AF_INET)
                    
268    s.connect((SSL_URL, SSL_PORT))
                    
300    #--Positive
                    
301    s = socket.socket(socket.AF_INET)
                    
302    s.connect((SSL_URL, SSL_PORT))
                    
334    #--Positive
                    
335    s = socket.socket(socket.AF_INET)
                    
336    s.connect((SSL_URL, SSL_PORT))
                    
                
ValidationPlugin.java git://github.com/playframework/play.git | Java | 201 lines
                    
155        if (Http.Response.current() == null) {
                    
156            // Some request like WebSocket don't have any response
                    
157            return;
                    
                
InventoryPacket.java http://aionxemu.googlecode.com/svn/trunk/ | Java | 437 lines
                    
245            writeFusionStones(buf, item);
                    
246            writeC(buf, item.hasOptionalFusionSocket() ? item.getOptionalFusionSocket() : 0x00);
                    
247        }
                    
261        writeD(buf, item.getItemSkinTemplate().getTemplateId());
                    
262        writeC(buf, item.hasOptionalSocket() ? item.getOptionalSocket() : 0x00);
                    
263
                    
396        writeD(buf, item.getItemSkinTemplate().getTemplateId());
                    
397        writeC(buf, item.hasOptionalSocket() ? item.getOptionalSocket() : 0x00);
                    
398
                    
                
libs.m4 https://amanda.svn.sourceforge.net/svnroot/amanda | m4 | 378 lines
                    
74#
                    
75#   Check for the libraries we'll need to use sockets, etc.
                    
76#
                    
80	*sgi-irix*)
                    
81			    AC_CHECK_LIB(socket,main)
                    
82			    ;;
                    
85			    AC_CHECK_LIB(nsl,main)
                    
86			    AC_CHECK_LIB(socket,main)
                    
87			    AC_CHECK_LIB(sun,main)
                    
                
Program.vb https://hg01.codeplex.com/sharpsnmplib | Visual Basic | 217 lines
                    
13Imports System.Net
                    
14Imports System.Net.Sockets
                    
15
                    
192            Console.WriteLine(ex)
                    
193        Catch ex As SocketException
                    
194            Console.WriteLine(ex)
                    
                
WebSocket.java git://github.com/Atmosphere/atmosphere.git | Java | 431 lines
                    
49    protected static final Logger logger = LoggerFactory.getLogger(WebSocket.class);
                    
50    public final static String WEBSOCKET_INITIATED = WebSocket.class.getName() + ".initiated";
                    
51    public final static String WEBSOCKET_SUSPEND = WebSocket.class.getName() + ".suspend";
                    
61    private final AtmosphereConfig config;
                    
62    private WebSocketHandler webSocketHandler;
                    
63    protected ByteBuffer bb;
                    
91
                    
92    protected WebSocket webSocketHandler(WebSocketHandler webSocketHandler) {
                    
93        this.webSocketHandler = webSocketHandler;
                    
107
                    
108    public WebSocketHandler webSocketHandler() {
                    
109        return webSocketHandler;
                    
150    /**
                    
151     * Return the an {@link AtmosphereResource} used by this WebSocket, or null if the WebSocket has been closed
                    
152     * before the WebSocket message has been processed.
                    
                
Config.java http://hyk-proxy.googlecode.com/svn/trunk/ | Java | 653 lines
                    
21
                    
22import javax.net.ssl.SSLSocketFactory;
                    
23import javax.xml.bind.JAXBContext;
                    
85
                    
86	public static class SimpleSocketAddress
                    
87	{
                    
207				connectionConfig
                    
208				        .setSocketFactory(SSLSocketFactory.getDefault());
                    
209			}
                    
                
libxt_TEE.c http://droidwall.googlecode.com/svn/trunk/ | C | 0 lines
                    
10 */
                    
11#include <sys/socket.h>
                    
12#include <getopt.h>
                    
                
ZFrame.html git://github.com/rjsmith/hxzmq.git | HTML | 563 lines
                    
123			<a name="recvFrame()"></a>
                    
124	<span class="name">recvFrame</span>(socket : <a href="../../org/zeromq/ZMQSocket.html" class="type">ZMQSocket</a>) : <a href="../../org/zeromq/ZFrame.html" class="type">ZFrame</a>
                    
125		</h3>
                    
132					<dt>parameters</dt>
                    
133					<dd><code>socket</code> Socket to read from</dd>
                    
134											<!-- method return types comments -->
                    
145		<div class="comment">
                    
146      Receives single frame from socket, returns the received frame object, or null if the recv
                    
147      was interrupted. Does a blocking recv, if you want to not block then use
                    
155			<a name="recvFrameNoWait()"></a>
                    
156	<span class="name">recvFrameNoWait</span>(socket : <a href="../../org/zeromq/ZMQSocket.html" class="type">ZMQSocket</a>) : <a href="../../org/zeromq/ZFrame.html" class="type">ZFrame</a>
                    
157		</h3>
                    
412			<a name="send()"></a>
                    
413	<span class="name">send</span>(socket : <a href="../../org/zeromq/ZMQSocket.html" class="type">ZMQSocket</a>, ?flags : Int) : Void
                    
414		</h3>
                    
                
resource.lisp git://github.com/3b/clws.git | Lisp | 255 lines
                    
110(defgeneric resource-client-disconnected (resource client)
                    
111  (:documentation "Called when a client disconnected from a WebSockets resource."))
                    
112
                    
114  (:documentation "Called when a client finishes connecting to a
                    
115WebSockets resource, and data can be sent to the client.
                    
116
                    
125  ;;; instead of per message?
                    
126  (:documentation "Called when a client sent a frame to a WebSockets resource."))
                    
127(defgeneric resource-received-text (resource client message)
                    
127(defgeneric resource-received-text (resource client message)
                    
128  (:documentation "Called when a client sent a text message to a WebSockets resource."))
                    
129
                    
130(defgeneric resource-received-binary (resource client message)
                    
131  (:documentation "Called when a client sent a binary message to a WebSockets resource."))
                    
132
                    
                
GangliaSink.java git://github.com/cloudera/flume.git | Java | 338 lines
                    
100
                    
101  private DatagramSocket datagramSocket;
                    
102  final private String attr; // turns into the metric name.
                    
176    try {
                    
177      datagramSocket = new DatagramSocket();
                    
178    } catch (SocketException se) {
                    
188  public void close() throws IOException, InterruptedException {
                    
189    if (datagramSocket == null) {
                    
190      LOG.warn("Double close");
                    
233    // send to each ganglia metrics listener/server
                    
234    for (SocketAddress socketAddress : metricsServers) {
                    
235      DatagramPacket packet = new DatagramPacket(buffer, offset, socketAddress);
                    
250
                    
251    for (SocketAddress socketAddress : metricsServers) {
                    
252      DatagramPacket packet = new DatagramPacket(buffer, offset, socketAddress);
                    
                
os.c https://bitbucket.org/ericvh/hare/ | C | 525 lines
                    
8#include	<sys/resource.h>
                    
9#include 	<sys/socket.h>
                    
10#include	<sys/time.h>
                    
                
syscalls.S git://github.com/torvalds/linux.git | Assembly | 339 lines
                    
120	CALL(sys_ni_syscall)		/* ioperm for i386 */
                    
121	CALL(sys_socketcall)
                    
122	CALL(sys_syslog)
                    
                
syscall_table.S git://github.com/torvalds/linux.git | Assembly | 328 lines
                    
103	.long sys_ni_syscall		/* ioperm syscall holder */
                    
104	.long sys_socketcall
                    
105	.long sys_syslog
                    
                
BSPPeerImpl.java https://svn.apache.org/repos/asf/incubator/hama/ | Java | 0 lines
                    
20import java.io.IOException;
                    
21import java.net.InetSocketAddress;
                    
22import java.util.Iterator;
                    
79
                    
80  private InetSocketAddress peerAddress;
                    
81  private Counters counters;
                    
130        .getInt(Constants.PEER_PORT, Constants.DEFAULT_PEER_PORT);
                    
131    peerAddress = new InetSocketAddress(bindAddress, bindPort);
                    
132    initialize();
                    
240    enterBarrier();
                    
241    Iterator<Entry<InetSocketAddress, LinkedList<BSPMessage>>> it = messenger
                    
242        .getMessageIterator();
                    
244    while (it.hasNext()) {
                    
245      Entry<InetSocketAddress, LinkedList<BSPMessage>> entry = it.next();
                    
246      final InetSocketAddress addr = entry.getKey();
                    
                
StartOzServer.oz git://github.com/briancarper/dotfiles.git | Oz | 221 lines
                    
99
                    
100/** %% Creates a TCP socket server. Expects a Host (e.g., 'localhost') and a PortNo and returns a server plus its corresponding client. This client is an instance of Open.socket, and is the interface for reading and writing into the socket.
                    
101%% MakeServer blocks until the server listens. However, waiting until a connection has been accepted happens in its own thread (i.e. MakeServer does only block until the server listens).
                    
141declare
                    
142%% Copied from OzServer/source/Socket.oz
                    
143local
                    
144   proc {Aux Socket Size Stream}
                    
145      In = {Socket read(list:$
                    
146			size:Size)}
                    
158in
                    
159   /** %% The socket Server returns a stream of the strings it receives. The Server always waits until someone writes something into the socket, then the input is immediately written to a stream and the Server waits again.
                    
160   %% */
                    
181%%
                    
182%% Send socket input to compiler and send results back to socket
                    
183%%
                    
                
socket.c git://anongit.freedesktop.org/git/xorg/app/xdm.git/ | C | 558 lines
                    
54 *
                    
55 * socket.c - Support for BSD sockets
                    
56 */
                    
64#  include <errno.h>
                    
65#  include "dm_socket.h"
                    
66
                    
74
                    
75extern FD_TYPE	WellKnownSocketsMask;
                    
76extern int	WellKnownSocketsMax;
                    
78void
                    
79CreateWellKnownSockets (void)
                    
80{
                    
87#  if defined(IPv6) && defined(AF_INET6)
                    
88    chooserFd = socket (AF_INET6, SOCK_STREAM, 0);
                    
89    if (chooserFd == -1)
                    
                
loaders.php git://github.com/speedmax/h2o-php.git | PHP | 290 lines
                    
251	/**
                    
252	 * @var host default is file socket 
                    
253	 */
                    
                
NetworkUtils.java git://github.com/CyanogenMod/android_frameworks_base.git | Java | 376 lines
                    
42    /**
                    
43     * Attaches a socket filter that accepts DHCP packets to the given socket.
                    
44     */
                    
47    /**
                    
48     * Attaches a socket filter that accepts ICMPv6 router advertisements to the given socket.
                    
49     * @param fd the socket's {@link FileDescriptor}.
                    
51     */
                    
52    public native static void attachRaFilter(FileDescriptor fd, int packetType) throws SocketException;
                    
53
                    
58     */
                    
59    public native static void setupRaSocket(FileDescriptor fd, int ifIndex) throws SocketException;
                    
60
                    
90     */
                    
91    public native static int bindSocketToNetwork(int socketfd, int netId);
                    
92
                    
                
setup_once.h git://github.com/zpao/spidernode.git | C Header | 488 lines
                    
101#if defined(__minix)
                    
102/* Minix doesn't support recv on TCP sockets */
                    
103#define sread(x,y,z) (ssize_t)read((RECV_TYPE_ARG1)(x), \
                    
113 * HAVE_RECV is defined if you have a function named recv()
                    
114 * which is used to read incoming data from sockets. If your
                    
115 * function has another name then don't define HAVE_RECV.
                    
121 * HAVE_SEND is defined if you have a function named send()
                    
122 * which is used to write outgoing data on a connected socket.
                    
123 * If yours has another name then don't define HAVE_SEND.
                    
153#if defined(__minix)
                    
154/* Minix doesn't support send on TCP sockets */
                    
155#define swrite(x,y,z) (ssize_t)write((SEND_TYPE_ARG1)(x), \
                    
186/*
                    
187 * Currently recvfrom is only used on udp sockets.
                    
188 */
                    
                
WebSocket00.h http://unitt.googlecode.com/svn/projects/ | C Header | 181 lines
                    
31    WebSocketReadyStateConnecting = 0, //The connection has not yet been established.
                    
32    WebSocketReadyStateOpen = 1, //The WebSocket connection is established and communication is possible.
                    
33    WebSocketReadyStateClosing = 2, //The connection is going through the closing handshake.
                    
70    NSString* origin;
                    
71    AsyncSocket* socket;
                    
72    WebSocketReadyState readystate;
                    
87/**
                    
88 * Callback delegate for websocket events.
                    
89 **/
                    
111 * - WebSocketReadyStateConnecting: The connection has not yet been established.
                    
112 * - WebSocketReadyStateOpen: The WebSocket connection is established and communication is possible.
                    
113 * - WebSocketReadyStateClosing: The connection is going through the closing handshake.
                    
156
                    
157+ (id) webSocketWithURLString:(NSString*) aUrlString delegate:(id<WebSocketDelegate>) aDelegate origin:(NSString*) aOrigin protocols:(NSArray*) aProtocols tlsSettings:(NSDictionary*) aTlsSettings verifyHandshake:(BOOL) aVerifyHandshake;
                    
158- (id) initWithURLString:(NSString *) aUrlString delegate:(id<WebSocketDelegate>) aDelegate origin:(NSString*) aOrigin protocols:(NSArray*) aProtocols tlsSettings:(NSDictionary*) aTlsSettings verifyHandshake:(BOOL) aVerifyHandshake;
                    
                
configure.ac http://jslibs.googlecode.com/svn/trunk/ | m4 | 320 lines
                    
115AC_CHECK_HEADERS(sys/syscall.h)
                    
116AC_CHECK_HEADERS(sys/socket.h)  # optional; for forking out to symbolizer
                    
117AC_CHECK_HEADERS(sys/wait.h)    # optional; for forking out to symbolizer
                    
                
README.md git://github.com/joyent/node.git | Markdown | 179 lines
                    
44    http_parser_init(parser, HTTP_REQUEST);
                    
45    parser->data = my_socket;
                    
46
                    
46
                    
47When data is received on the socket execute the parser and check for errors.
                    
48
                    
91HTTP supports upgrading the connection to a different protocol. An
                    
92increasingly common example of this is the Web Socket protocol which sends
                    
93a request like
                    
95        GET /demo HTTP/1.1
                    
96        Upgrade: WebSocket
                    
97        Connection: Upgrade
                    
99        Origin: http://example.com
                    
100        WebSocket-Protocol: sample
                    
101
                    
                
sendmail.c https://bitbucket.org/dcid/ossec-hids/ | C | 594 lines
                    
60{
                    
61    int socket, i = 0, final_to_sz;
                    
62    char *msg;
                    
67    /* Connecting to the smtp server */	
                    
68    socket = OS_ConnectTCP(SMTP_DEFAULT_PORT, mail->smtpserver, 0);
                    
69    if(socket < 0)
                    
70    {
                    
71        return(socket);
                    
72    }
                    
75    /* Receiving the banner */
                    
76    msg = OS_RecvTCP(socket, OS_SIZE_1024);
                    
77    if((msg == NULL)||(!OS_Match(VALIDBANNER, msg)))
                    
81            free(msg);
                    
82        close(socket);
                    
83        return(OS_INVALID);	
                    
                
Collectd.pm git://github.com/octo/collectd.git | Perl | 218 lines
                    
20
                    
21=item collectd_socket [ socket path ]	    (default: /var/run/collectd-email)
                    
22
                    
22
                    
23Where the collectd socket is
                    
24
                    
53collect statistical informations in rrd files to create some nice looking
                    
54graphs with rrdtool. They communicate over a unix socket that the collectd
                    
55plugin creates. The generated graphs will be placed in /var/lib/collectd/email
                    
85use Time::HiRes qw(usleep);
                    
86use IO::Socket;
                    
87
                    
154		for (my $i = 0; $i < $self->{main}->{conf}->{collectd_retries} ; ++$i) {
                    
155		        my ($socket_path) = $self->{main}->{conf}->{collectd_socket} =~ /(.*)/; # Untaint path, which can contain any characters.
                    
156			last if $sock = new IO::Socket::UNIX $socket_path;
                    
                
addrconf_core.c git://github.com/torvalds/linux.git | C | 257 lines
                    
13/* if ipv6 module registers this function is used by xfrm to force all
                    
14 * sockets to relookup their nodes - this is fairly expensive, be
                    
15 * careful
                    
                
test_urllibnet.py https://IronPython.svn.codeplex.com/svn | Python | 196 lines
                    
5
                    
6import socket
                    
7import urllib
                    
30    def setUp(self):
                    
31        socket.setdefaulttimeout(self.TIMEOUT)
                    
32
                    
33    def tearDown(self):
                    
34        socket.setdefaulttimeout(None)
                    
35
                    
115                not hasattr(os, 'fdopen')):
                    
116            # On Windows, socket handles are not file descriptors; this
                    
117            # test can't pass on Windows.
                    
                
ApnsConnectionTest.java git://github.com/notnoop/java-apns.git | Java | 187 lines
                    
136    /**
                    
137     * Unlike in the feedback case, push messages won't expose the socket timeout,
                    
138     * as the read is done in a separate monitoring thread.
                    
                
dalienv.cpp git://github.com/hpcc-systems/HPCC-Platform.git | C++ | 416 lines
                    
120        if (ret==MachineOsUnknown) { // lets try asking dafilesrv
                    
121            SocketEndpoint ep(0,ip);
                    
122            switch (getDaliServixOs(ep)) { 
                    
247        RemoteFilename rfn;
                    
248        SocketEndpoint ep;
                    
249        ep.ipset(ip);
                    
306                    char psep;
                    
307                    SocketEndpoint ep(ips2);
                    
308                    if (getDaliServixOs(ep)==DAFS_OSwindows) {
                    
390
                    
391IPropertyTree *envGetInstallNASHooks(SocketEndpoint *myEp)
                    
392{
                    
396
                    
397IPropertyTree *envGetInstallNASHooks(IPropertyTree *nasPTree, SocketEndpoint *myEp)
                    
398{
                    
                
port.h http://rpostgresql.googlecode.com/svn/trunk/ | C Header | 490 lines
                    
19
                    
20/* socket has a different definition on WIN32 */
                    
21#ifndef WIN32
                    
21#ifndef WIN32
                    
22typedef int pgsocket;
                    
23
                    
23
                    
24#define PGINVALID_SOCKET (-1)
                    
25#else
                    
25#else
                    
26typedef SOCKET pgsocket;
                    
27
                    
27
                    
28#define PGINVALID_SOCKET INVALID_SOCKET
                    
29#endif
                    
                
RemoteDebuggerClient.java git://github.com/JetBrains/intellij-community.git | Java | 544 lines
                    
23import java.io.IOException;
                    
24import java.net.SocketException;
                    
25import java.rmi.Naming;
                    
74    while (t != null) {
                    
75      if (t instanceof SocketException || t instanceof EOFException) {
                    
76        throw new DebuggerStoppedException();
                    
                
bsdudp-security.c https://amanda.svn.sourceforge.net/svnroot/amanda | C | 336 lines
                    
45#ifndef SO_RCVBUF
                    
46#undef DUMPER_SOCKET_BUFFERING
                    
47#endif
                    
90/*
                    
91 * This is data local to the datagram socket.  We have one datagram
                    
92 * per process, so it is global.
                    
169    /*
                    
170     * Only init the socket once
                    
171     */
                    
272    /*
                    
273     * We assume in and out point to the same socket, and just use
                    
274     * in.
                    
275     */
                    
276    dgram_socket(&netfd4.dgram, in);
                    
277    dgram_socket(&netfd6.dgram, in);
                    
                
drvconn.cc http://versaplex.googlecode.com/svn/trunk/ | C++ | 522 lines
                    
15#include <sys/types.h>
                    
16#include <sys/socket.h>
                    
17#define NEAR
                    
                
internal.clj git://github.com/ragnard/redis-clojure.git | Clojure | 267 lines
                    
6(defstruct connection
                    
7  :host :port :password :db :timeout :socket :reader :writer)
                    
8
                    
32  (let [{:keys [host port timeout]} server
                    
33        socket (Socket. #^String host #^Integer port)]
                    
34    (doto socket
                    
40  (let [connection (merge *connection* server-spec)]
                    
41    (with-open [#^Socket socket (connect-to-server connection)]
                    
42      (let [input-stream (.getInputStream socket)
                    
45        (binding [*connection* (assoc connection 
                    
46                                 :socket socket
                    
47                                 :reader reader)]
                    
56  [#^String cmd]
                    
57  (let [out (.getOutputStream (#^Socket socket*))
                    
58        bytes (.getBytes cmd)]
                    
                
versaplexd.cs http://versaplex.googlecode.com/svn/trunk/ | C# | 278 lines
                    
239        socket.Blocking = true;
                    
240        SocketHandle = (long)socket.Handle;
                    
241        Stream = new NetworkStream(socket);
                    
246        AbstractUnixEndPoint ep = new AbstractUnixEndPoint(path);
                    
247        VxNotifySocket client = new VxNotifySocket(AddressFamily.Unix,
                    
248                SocketType.Stream, 0);
                    
255        UnixEndPoint ep = new UnixEndPoint(path);
                    
256        VxNotifySocket client = new VxNotifySocket(AddressFamily.Unix,
                    
257                SocketType.Stream, 0);
                    
266        IPEndPoint ep = new IPEndPoint(ip, port);
                    
267        VxNotifySocket client = new VxNotifySocket(AddressFamily.InterNetwork,
                    
268						   SocketType.Stream, 0);
                    
273    protected VxNotifySocket socket;
                    
274    public VxNotifySocket Socket {
                    
275        get { return socket; }
                    
                
config-tandem-nsk-mips-v3.h https://bitbucket.org/CatrinaEmu/core/ | C Header | 465 lines
                    
118
                    
119// OS/compiler uses size_t * rather than int * for socket lengths
                    
120#define ACE_HAS_SIZET_SOCKET_LEN
                    
218
                    
219// Platform lacks the socketpair() call
                    
220#define ACE_LACKS_SOCKETPAIR
                    
221
                    
222// Platform limits the maximum socket message size.
                    
223#define ACE_HAS_SOCK_BUF_SIZE_MAX
                    
                
SimpleMail.cs http://simple-assembly-explorer.googlecode.com/svn/trunk/ | C# | 315 lines
                    
196        //    {
                    
197        //        using (Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp))
                    
198        //        {
                    
201        //            int timeout = 10000;
                    
202        //            socket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReceiveTimeout, timeout);
                    
203        //            int port = 25;
                    
203        //            int port = 25;
                    
204        //            socket.Connect(_smtpServer, port);
                    
205        //            byte[] buffer = new byte[0x400];
                    
206
                    
207        //            int count = socket.Receive(buffer);
                    
208        //            string result = Encoding.ASCII.GetString(buffer, 0, count);
                    
214        //            socket.Send(bytes);
                    
215        //            count = socket.Receive(buffer);
                    
216        //            result = Encoding.ASCII.GetString(buffer, 0, count);
                    
                
server.h https://quake.svn.sourceforge.net/svnroot/quake | C++ Header | 286 lines
                    
109
                    
110	struct qsocket_s *netconnection;	// communications handle
                    
111
                    
248void SV_ClientThink (void);
                    
249void SV_AddClientToServer (struct qsocket_s	*ret);
                    
250
                    
                
urlfetch_stub.py https://code.google.com/p/soc/ | Python | 453 lines
                    
41import os
                    
42import socket
                    
43import StringIO
                    
357        if not _CONNECTION_SUPPORTS_TIMEOUT:
                    
358          orig_timeout = socket.getdefaulttimeout()
                    
359        try:
                    
362
                    
363            socket.setdefaulttimeout(deadline)
                    
364          connection.request(method, full_path, payload, adjusted_headers)
                    
371          if not _CONNECTION_SUPPORTS_TIMEOUT:
                    
372            socket.setdefaulttimeout(orig_timeout)
                    
373          connection.close()
                    
378          str(e))
                    
379      except socket.timeout, e:
                    
380        raise apiproxy_errors.ApplicationError(
                    
                
config-win32-borland.h git://github.com/ProjectSkyfire/SkyFireEMU.git | C Header | 180 lines
                    
91#define ACE_LACKS_SYS_UIO_H
                    
92#define ACE_LACKS_SYS_SOCKET_H
                    
93#define ACE_LACKS_NETINET_IN_H
                    
                
mysqli_driver.php git://github.com/EllisLab/CodeIgniter.git | PHP | 540 lines
                    
118	{
                    
119		// Do we have a socket path?
                    
120		if ($this->hostname[0] === '/')
                    
123			$port = NULL;
                    
124			$socket = $this->hostname;
                    
125		}
                    
130			$port = empty($this->port) ? NULL : $this->port;
                    
131			$socket = NULL;
                    
132		}
                    
202
                    
203		if ($this->_mysqli->real_connect($hostname, $this->username, $this->password, $this->database, $port, $socket, $client_flags))
                    
204		{
                    
                
zookeeper_ganglia.py git://github.com/apache/zookeeper.git | Python | 247 lines
                    
24import sys
                    
25import socket
                    
26import time
                    
64    def _create_socket(self):
                    
65        return socket.socket()
                    
66
                    
68        """ Send a 4letter word command to the server """
                    
69        s = self._create_socket()
                    
70        s.settimeout(self._timeout)
                    
                
FileAssertTests.cs git://github.com/shouldly/shouldly.git | C# | 437 lines
                    
9using System.Reflection;
                    
10using System.Net.Sockets;
                    
11
                    
                
 

Source

Language