PageRenderTime 407ms queryTime 111ms sortTime 11ms getByIdsTime 42ms findMatchingLines 35ms

100+ results results for 'socket repo:mstreet_fceia/distfs' (407 ms)

Not the results you expected?
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	}
                    
                
xpc_partition.c git://github.com/torvalds/linux.git | C | 534 lines
                    
146	}
                    
147	rp = (struct xpc_rsvd_page *)__va(xp_socket_pa(rp_pa));
                    
148
                    
                
HTUtils.h git://github.com/alandipert/ncsa-mosaic.git | C Header | 268 lines
                    
210#define HT_REDIRECTING 29998
                    
211#define HT_LOADED 29999                 /* Instead of a socket */
                    
212#define HT_INTERRUPTED -29998
                    
                
HTTPURLLoader.as http://crossxhr.googlecode.com/svn/trunk/ | ActionScript | 197 lines
                    
28		
                    
29		private var socket:Socket;
                    
30		private var headerComplete:Boolean = false;
                    
48					
                    
49			socket = new Socket();
                    
50
                    
52			socket.addEventListener( "close" , onCloseEvent , false, 0 );
                    
53			socket.addEventListener( "ioError" , onIOErrorEvent , false, 0 );
                    
54			socket.addEventListener( "securityError" , onSecurityErrorEvent , false, 0 );
                    
54			socket.addEventListener( "securityError" , onSecurityErrorEvent , false, 0 );
                    
55			socket.addEventListener( "socketData" , onSocketDataEvent , false , 0 );
                    
56		}
                    
109			var str:String = "";
                    
110			try { str = socket.readUTFBytes(socket.bytesAvailable); } catch(e:Error) { }
                    
111			if(!headerComplete) {
                    
                
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
                    
                
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;
                    
                
test_urllib2net.py https://bitbucket.org/arigo/cpython-withatomic/ | Python | 365 lines
                    
7import os
                    
8import socket
                    
9import urllib.error
                    
80
                    
81class CloseSocketTest(unittest.TestCase):
                    
82
                    
84        # calling .close() on urllib2's response objects should close the
                    
85        # underlying socket
                    
86        url = "http://www.python.org/"
                    
135##     def test_cnri(self):
                    
136##         if socket.gethostname() == 'bitdiddle':
                    
137##             localhost = 'bitdiddle.cnri.reston.va.us'
                    
137##             localhost = 'bitdiddle.cnri.reston.va.us'
                    
138##         elif socket.gethostname() == 'bitdiddle.concentric.net':
                    
139##             localhost = 'localhost'
                    
                
email.parser.rst https://bitbucket.org/arigo/cpython-withatomic/ | ReStructuredText | 292 lines
                    
27a stream which might block waiting for more input (e.g. reading an email message
                    
28from a socket).  The :class:`FeedParser` can consume and parse the message
                    
29incrementally, and only returns the root object when you close the parser [#]_.
                    
43as would be necessary when reading the text of an email message from a source
                    
44that can block (e.g. a socket).  The :class:`FeedParser` can of course be used
                    
45to parse an email message fully contained in a string or a file, but the classic
                    
                
HttpClientService.java http://andrico.googlecode.com/svn/trunk/ | Java | 354 lines
                    
40import org.apache.http.conn.ClientConnectionManager;
                    
41import org.apache.http.conn.scheme.PlainSocketFactory;
                    
42import org.apache.http.conn.scheme.Scheme;
                    
43import org.apache.http.conn.scheme.SchemeRegistry;
                    
44import org.apache.http.conn.scheme.SocketFactory;
                    
45import org.apache.http.entity.mime.MultipartEntity;
                    
186        // by the default operator to look up socket factories.
                    
187        final SocketFactory sf = PlainSocketFactory.getSocketFactory();
                    
188        supportedSchemes.register(new Scheme("http", sf, 80));
                    
                
fake.php https://code.google.com/p/php-blackops-rcon/ | PHP | 546 lines
                    
30    /**
                    
31     * Socket res
                    
32     *
                    
34     */
                    
35    protected $socket = NULL;
                    
36
                    
103    {
                    
104        //fclose($this->socket);
                    
105    }
                    
118    /**
                    
119     * Get socket resource
                    
120     *
                    
122     */
                    
123    public function get_socket()
                    
124    {
                    
                
AbstractClient.java http://loon-simple.googlecode.com/svn/trunk/ | Java | 508 lines
                    
100		sc.init(null, trustAllCerts, null);
                    
101		javax.net.ssl.HttpsURLConnection.setDefaultSSLSocketFactory(sc
                    
102				.getSocketFactory());
                    
402				port, file, connection.getContentLength(), threads, tmp_file);
                    
403		SocketManager sm = new SocketManager(info);
                    
404		ExternalDownload down = new ExternalDownload(header, sm);
                    
                
name_table.h git://github.com/torvalds/linux.git | C Header | 152 lines
                    
57 * @scope: scope of publication, TIPC_NODE_SCOPE or TIPC_CLUSTER_SCOPE
                    
58 * @node: network address of publishing socket's node
                    
59 * @port: publishing port
                    
67 * @binding_sock: all publications from the same socket which bound this one
                    
68 *   Used by socket to withdraw publications when socket is unbound/released
                    
69 * @local_publ: list of identical publications made from this node
                    
                
beos.c git://github.com/zpao/spidernode.git | C | 264 lines
                    
44#include <sys/types.h>
                    
45#include <sys/socket.h>
                    
46#include <sys/time.h>
                    
                
SwivelHingeJoint.cs https://hg01.codeplex.com/bepuphysics | C# | 134 lines
                    
24            IsActive = false;
                    
25            BallSocketJoint = new BallSocketJoint();
                    
26            AngularJoint = new SwivelHingeAngularJoint();
                    
31
                    
32            Add(BallSocketJoint);
                    
33            Add(AngularJoint);
                    
52                connectionB = TwoEntityConstraint.WorldEntity;
                    
53            BallSocketJoint = new BallSocketJoint(connectionA, connectionB, anchor);
                    
54            AngularJoint = new SwivelHingeAngularJoint(connectionA, connectionB, hingeAxis, -BallSocketJoint.OffsetB);
                    
56            HingeMotor = new RevoluteMotor(connectionA, connectionB, hingeAxis);
                    
57            TwistLimit = new TwistLimit(connectionA, connectionB, BallSocketJoint.OffsetA, -BallSocketJoint.OffsetB, 0, 0);
                    
58            TwistMotor = new TwistMotor(connectionA, connectionB, BallSocketJoint.OffsetA, -BallSocketJoint.OffsetB);
                    
111        /// </summary>
                    
112        public BallSocketJoint BallSocketJoint { get; private set; }
                    
113
                    
                
TcpServer.fs git://github.com/fractureio/fracture.git | F# | 0 lines
                    
21    let connections = ref 0
                    
22    let listeningSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)
                    
23    let mutable disposed = false
                    
50    and processAccept (args) =
                    
51        let acceptSocket = args.AcceptSocket
                    
52        match args.SocketError with
                    
82        | SocketError.Disconnecting when disposed -> ()// stop accepting here, we're being shutdown.
                    
83        | _ -> Debug.WriteLine (sprintf "socket error on accept: %A" args.SocketError)
                    
84         
                    
91        let socket = sd.Socket
                    
92        if args.SocketError = SocketError.Success && args.BytesTransferred > 0 then
                    
93            //process received data, check if data was given on connection.
                    
116            failwith "Buffer overflow or send buffer timeout" //graceful termination?  
                    
117        | _ -> args.SocketError.ToString() |> printfn "socket error on send: %s"
                    
118
                    
                
ProxyClientFactory.cs http://counterstrike.googlecode.com/svn/trunk/ | C# | 209 lines
                    
28using System.Text;
                    
29using System.Net.Sockets;
                    
30
                    
72	/// // create a connection through the proxy to www.starksoft.com over port 80
                    
73    /// System.Net.Sockets.TcpClient tcpClient = proxy.CreateConnection("www.starksoft.com", 80);
                    
74    /// </code>
                    
                
test_asyncore.py http://unladen-swallow.googlecode.com/svn/trunk/ | Python | 415 lines
                    
31    def __init__(self):
                    
32        self.socket = dummysocket()
                    
33
                    
195        if usedefault:
                    
196            socketmap = asyncore.socket_map
                    
197            try:
                    
200            finally:
                    
201                testmap, asyncore.socket_map = asyncore.socket_map, socketmap
                    
202        else:
                    
333        self.evt = threading.Event()
                    
334        self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
                    
335        self.sock.settimeout(3)
                    
347        d = dispatcherwithsend_noread()
                    
348        d.create_socket(socket.AF_INET, socket.SOCK_STREAM)
                    
349        d.connect((HOST, self.port))
                    
                
SOCK_Connector.cpp git://github.com/insider42/mangos.git | C++ | 363 lines
                    
6#include "ace/OS_NS_unistd.h"
                    
7#include "ace/OS_NS_sys_socket.h"
                    
8#include "ace/os_include/os_fcntl.h"
                    
37
                    
38  // Only open a new socket if we don't already have a valid handle.
                    
39  if (new_stream.get_handle () == ACE_INVALID_HANDLE
                    
59
                    
60  // Only open a new socket if we don't already have a valid handle.
                    
61  if (new_stream.get_handle () == ACE_INVALID_HANDLE
                    
121#if defined(ACE_WIN32)
                    
122              // In order to detect when the socket that has been
                    
123              // bound to is in TIME_WAIT we need to do the connect
                    
128              // error state. The error code is then retrieved with
                    
129              // getsockopt(). Good sockets however will return from
                    
130              // the select() with ETIME - in this case return
                    
                
TCPTransportClient.java http://mobicents.googlecode.com/svn/trunk/ | Java | 367 lines
                    
98    }
                    
99    socketChannel = SelectorProvider.provider().openSocketChannel();
                    
100    if (origAddress != null) {
                    
116    socketChannel.configureBlocking(true);
                    
117    destAddress = new InetSocketAddress(socket.getInetAddress(), socket.getPort());
                    
118  }
                    
122    if(socketDescription == null && socketChannel != null) {
                    
123      socketDescription = socketChannel.socket().toString();
                    
124    }
                    
187  public void stop() throws Exception {
                    
188    logger.debug("Stopping transport. Socket is [{}]", socketDescription);
                    
189    stop = true;
                    
273  boolean isConnected() {
                    
274    return socketChannel != null && socketChannel.isConnected();
                    
275  }
                    
                
sckaddr.h http://dynamica.googlecode.com/svn/trunk/ | C Header | 324 lines
                    
20#elif defined(__VMS__)
                    
21    #include <socket.h>
                    
22
                    
31    #include <sys/types.h>
                    
32    #include <sys/socket.h>
                    
33    #include <netinet/in.h>
                    
65
                    
66#ifdef wxHAS_UNIX_DOMAIN_SOCKETS
                    
67template <> struct AddressFamily<sockaddr_un> { enum { value = AF_UNIX }; };
                    
67template <> struct AddressFamily<sockaddr_un> { enum { value = AF_UNIX }; };
                    
68#endif // wxHAS_UNIX_DOMAIN_SOCKETS
                    
69
                    
73
                    
74// Represents a socket endpoint, e.g. an (address, port) pair for PF_INET
                    
75// sockets. It can be initialized from an existing sockaddr struct and also
                    
                
meteobox.c git://github.com/Yniold/liftsrc.git | C | 353 lines
                    
46#include <pthread.h>
                    
47#include <sys/socket.h>
                    
48#include <sys/types.h>
                    
126{
                    
127   .iFD = -1,                      /* socket FD */
                    
128     .Valid = 0,                /* signal if data is valid or not to main thread */
                    
138
                    
139// bind to socket and create the parser thread
                    
140//
                    
175
                    
176   // socket structure
                    
177   struct sockaddr_in ServerAddress;
                    
187
                    
188	     // create SocketFD
                    
189	     sStructure->iFD = socket(AF_INET, SOCK_STREAM, 0);
                    
                
dlmast.c git://github.com/torvalds/linux.git | C | 487 lines
                    
20#include <linux/blkdev.h>
                    
21#include <linux/socket.h>
                    
22#include <linux/inet.h>
                    
                
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)
                    
                
errno.d git://github.com/SiegeLord/Tango-D2.git | D | 154 lines
                    
57    EIO = 5, // Input/output error
                    
58    EISCONN = 106, // Socket is already connected
                    
59    EISDIR = 21, // Is a directory
                    
106    ENOTBLK = 15, // Block device required
                    
107    ENOTCONN = 107, // Socket is not connected
                    
108    ENOTDIR = 20, // Not a directory
                    
111    ENOTRECOVERABLE = 131, // State not recoverable
                    
112    ENOTSOCK = 88, // Socket operation on non-socket
                    
113    ENOTSUP = 95, // Operation not supported
                    
116    ENXIO = 6, // Device not configured
                    
117    EOPNOTSUPP = 95, // Operation not supported on socket
                    
118    EOVERFLOW = 75, // Value too large to be stored in data type
                    
124    EPROTONOSUPPORT = 93, // Protocol not supported
                    
125    EPROTOTYPE = 91, // Protocol wrong type for socket
                    
126    ERANGE = 34, // Result too large
                    
                
writer.pl git://github.com/quartzjer/TeleHash.git | Perl | 451 lines
                    
9use IO::Select;
                    
10use Socket;
                    
11use JSON::DWIW;
                    
22$paddr = sockaddr_in($port, $iaddr);
                    
23socket(SOCKET, PF_INET, SOCK_DGRAM, $proto)   or die "socket: $!";
                    
24bind(SOCKET, $paddr)                          or die "bind: $!";
                    
25$sel = IO::Select->new();
                    
26$sel->add(\*SOCKET);
                    
27
                    
65	$connected = 1;
                    
66	my $caddr = recv(SOCKET, $buff, 8192, 0) || die("recv $!");
                    
67
                    
292	printf "SEND[%s]\t%s\n",$j->{"_to"},$js;
                    
293	if(!defined(send(SOCKET, $js, 0, $waddr)))
                    
294	{
                    
                
DatabaseMysql.cpp https://bitbucket.org/KPsN/trinitycore/ | C++ | 439 lines
                    
92
                    
93    std::string host, port_or_socket, user, password, database;
                    
94    int port;
                    
94    int port;
                    
95    char const* unix_socket;
                    
96
                    
101    if (iter != tokens.end())
                    
102        port_or_socket = *iter++;
                    
103    if (iter != tokens.end())
                    
116        port = 0;
                    
117        unix_socket = 0;
                    
118    }
                    
130        port = 0;
                    
131        unix_socket = port_or_socket.c_str();
                    
132    }
                    
                
callback.c git://github.com/CyanogenMod/cm-kernel.git | C | 257 lines
                    
84		/*
                    
85		 * Listen for a request on the socket
                    
86		 */
                    
163out_err:
                    
164	dprintk("NFS: Couldn't create callback socket or server thread; "
                    
165		"err = %d\n", ret);
                    
                
cardbus.c git://github.com/CyanogenMod/cm-kernel.git | C | 252 lines
                    
86    cards.  The "result" that is used externally is the cb_cis_virt
                    
87    pointer in the struct pcmcia_socket structure.
                    
88    
                    
90
                    
91static void cb_release_cis_mem(struct pcmcia_socket * s)
                    
92{
                    
100
                    
101static int cb_setup_cis_mem(struct pcmcia_socket * s, struct resource *res)
                    
102{
                    
129
                    
130int read_cb_mem(struct pcmcia_socket * s, int space, u_int addr, u_int len, void *ptr)
                    
131{
                    
209
                    
210int __ref cb_alloc(struct pcmcia_socket * s)
                    
211{
                    
                
Makefile.am git://github.com/bagder/curl.git | Makefile | 131 lines
                    
39 libcurl-tutorial.3 curl_easy_reset.3 curl_easy_escape.3		 \
                    
40 curl_easy_unescape.3 curl_multi_setopt.3 curl_multi_socket.3		 \
                    
41 curl_multi_timeout.3 curl_formget.3 curl_multi_assign.3		 \
                    
42 curl_easy_pause.3 curl_easy_recv.3 curl_easy_send.3			 \
                    
43 curl_multi_socket_action.3 curl_multi_wait.3 libcurl-symbols.3 	 \
                    
44 libcurl-thread.3 curl_multi_socket_all.3
                    
60 libcurl-tutorial.html curl_easy_reset.html curl_easy_escape.html	\
                    
61 curl_easy_unescape.html curl_multi_setopt.html curl_multi_socket.html	\
                    
62 curl_multi_timeout.html curl_formget.html curl_multi_assign.html	\
                    
63 curl_easy_pause.html curl_easy_recv.html curl_easy_send.html		\
                    
64 curl_multi_socket_action.html curl_multi_wait.html			\
                    
65 libcurl-symbols.html libcurl-thread.html curl_multi_socket_all.html
                    
81 curl_easy_reset.pdf curl_easy_escape.pdf curl_easy_unescape.pdf	 \
                    
82 curl_multi_setopt.pdf curl_multi_socket.pdf curl_multi_timeout.pdf	 \
                    
83 curl_formget.pdf curl_multi_assign.pdf curl_easy_pause.pdf		 \
                    
                
write.c http://newcnix.googlecode.com/svn/trunk/ | C | 343 lines
                    
36
                    
37extern ssize_t socket_write(
                    
38	struct inode * inoptr,
                    
74
                    
75	if(is_socket(inoptr)){
                    
76		writed = socket_write(
                    
                
ppc-linux-os.c git://github.com/sbcl/sbcl.git | C | 187 lines
                    
28#include "lispregs.h"
                    
29#include <sys/socket.h>
                    
30#include <sys/utsname.h>
                    
                
ControllerThreadSocketFactory.java http://google-enterprise-connector-sharepoint.googlecode.com/svn/trunk/ | Java | 165 lines
                    
90                public void doit() throws IOException {
                    
91                    setSocket(socketfactory.createSocket(host, port, localAddress, localPort));
                    
92                }                 
                    
100            }
                    
101            Socket socket = task.getSocket();
                    
102            if (task.exception != null) {
                    
107
                    
108    public static Socket createSocket(final SocketTask task, int timeout)
                    
109     throws IOException, UnknownHostException, ConnectTimeoutException
                    
117            }
                    
118            Socket socket = task.getSocket();
                    
119            if (task.exception != null) {
                    
137         */
                    
138        protected void setSocket(final Socket newSocket) {
                    
139            socket = newSocket;
                    
                
crossfire_test_client.py http://fbug.googlecode.com/svn/ | Python | 530 lines
                    
69  def start(self):
                    
70    #self.socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
                    
71    #try:
                    
81
                    
82    self.socket = socket.create_connection((self.host, self.port))
                    
83
                    
85    self.reader = PacketReader(self.socket, self.socketCondition)
                    
86    self.writer = PacketWriter(self.socket, self.socketCondition)
                    
87
                    
89    self.socket.send(HANDSHAKE_STRING)
                    
90    self.socket.send("\r\n")
                    
91    self.socket.send(TOOL_STRING)
                    
98      #self.conn.close()
                    
99      self.socket.close()
                    
100      #self.socketCondition.acquire()
                    
                
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
                    
                
os.c https://bitbucket.org/ericvh/hare/ | C | 648 lines
                    
23
                    
24#include 	<sys/socket.h>
                    
25#include	<sched.h>
                    
                
libslp_network.c https://openslp.svn.sourceforge.net/svnroot/openslp | C | 333 lines
                    
57    {
                    
58        G_SlpdSocket = socket(AF_INET,SOCK_STREAM,0);
                    
59        if(G_SlpdSocket >= 0)
                    
69                setsockopt(G_SlpdSocket,SOL_SOCKET,SO_RCVLOWAT,&lowat,sizeof(lowat));
                    
70                setsockopt(G_SlpdSocket,SOL_SOCKET,SO_SNDLOWAT,&lowat,sizeof(lowat));
                    
71
                    
85                  /* Could not connect to the slpd through the loopback */
                    
86                  close(G_SlpdSocket);
                    
87                  G_SlpdSocket = -1;
                    
103    
                    
104    return G_SlpdSocket;
                    
105}
                    
286    setsockopt(G_SlpdSocket,SOL_SOCKET,SO_RCVLOWAT,&lowat,sizeof(lowat));
                    
287    setsockopt(G_SlpdSocket,SOL_SOCKET,SO_SNDLOWAT,&lowat,sizeof(lowat));
                    
288    */
                    
                
raw_socket_service.hpp http://hadesmem.googlecode.com/svn/trunk/ | C++ Header | 0 lines
                    
1//
                    
2// raw_socket_service.hpp
                    
3// ~~~~~~~~~~~~~~~~~~~~~~
                    
10
                    
11#ifndef BOOST_ASIO_RAW_SOCKET_SERVICE_HPP
                    
12#define BOOST_ASIO_RAW_SOCKET_SERVICE_HPP
                    
23#if defined(BOOST_ASIO_HAS_IOCP)
                    
24# include <boost/asio/detail/win_iocp_socket_service.hpp>
                    
25#else
                    
25#else
                    
26# include <boost/asio/detail/reactive_socket_service.hpp>
                    
27#endif
                    
132
                    
133  /// Assign an existing native socket to a raw socket.
                    
134  boost::system::error_code assign(implementation_type& impl,
                    
                
AES.cs https://hg01.codeplex.com/deltaengine | C# | 282 lines
                    
60		/// the data stream and the privateKey. Since this is not very secure it is
                    
61		/// only used for testing, see <see cref="SocketHelper.SendMessageBytes"/>
                    
62		/// on a real use case, which uses the instance methods of this class.
                    
108		/// privateKey. Since this is not very secure it is only used for testing,
                    
109		/// see <see cref="SocketHelper.SendMessageBytes"/> on a real use case,
                    
110		/// which uses the instance methods of this class.
                    
                
arp.cpp http://es-operating-system.googlecode.com/svn/trunk/ | C++ | 470 lines
                    
38
                    
39    Socket::addAddressFamily(this);
                    
40}
                    
238    // Set the interface MAC address to this address.
                    
239    NetworkInterface* nic = Socket::getInterface(a->getScopeID());
                    
240    ASSERT(nic);
                    
                
Mysql.php git://github.com/ushahidi/Ushahidi_Web.git | PHP | 492 lines
                    
56		// Build the connection info
                    
57		$host = isset($host) ? $host : $socket;
                    
58		$port = isset($port) ? ':'.$port : '';
                    
                
DispatchDnsServer.cs https://eddn.svn.codeplex.com/svn | C# | 386 lines
                    
4using System.Text;
                    
5using System.Net.Sockets;
                    
6using System.Net;
                    
                
slpd_knownda.h https://openslp.svn.sourceforge.net/svnroot/openslp | C++ Header | 227 lines
                    
189void SLPDKnownDAActiveDiscovery(int seconds);
                    
190/* Add a socket to the outgoing list to do active DA discovery SrvRqst     */
                    
191/*									                                       */
                    
                
all-index-S.html http://as3mp3streamplayer.googlecode.com/svn/trunk/ | HTML | 123 lines
                    
41<td width="20"></td><td>
                    
42  Dispatched when the socket throws a security error
                    
43  </td>
                    
                
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
                    
                
mailer.py https://bitbucket.org/clarifiednetworks/abusehelper/ | Python | 372 lines
                    
1import time
                    
2import socket
                    
3import getpass
                    
201class MailerService(ReportBot):
                    
202    TOLERATED_EXCEPTIONS = (socket.error, smtplib.SMTPException)
                    
203
                    
                
ghiper.c git://github.com/bagder/curl.git | C | 436 lines
                    
25 */
                    
26/* Example application source code using the multi socket interface to
                    
27 * download many files at once.
                    
105    case     CURLM_INTERNAL_ERROR:     s = "CURLM_INTERNAL_ERROR";     break;
                    
106    case     CURLM_BAD_SOCKET:         s = "CURLM_BAD_SOCKET";         break;
                    
107    case     CURLM_UNKNOWN_OPTION:     s = "CURLM_UNKNOWN_OPTION";     break;
                    
216/* Assign information to a SockInfo structure */
                    
217static void setsock(SockInfo *f, curl_socket_t s, CURL *e, int act,
                    
218                    GlobalInfo *g)
                    
233/* Initialize a new SockInfo structure */
                    
234static void addsock(curl_socket_t s, CURL *easy, int action, GlobalInfo *g)
                    
235{
                    
429
                    
430  /* we don't call any curl_multi_socket*() function yet as we have no handles
                    
431     added! */
                    
                
SOCK_Acceptor.cpp git://github.com/TrinityCore/TrinityCore.git | C++ | 407 lines
                    
7#include "ace/OS_NS_string.h"
                    
8#include "ace/OS_NS_sys_socket.h"
                    
9#include "ace/os_include/os_fcntl.h"
                    
93    // Reset the event association inherited by the new handle.
                    
94    ::WSAEventSelect ((SOCKET) new_handle, 0, 0);
                    
95#else
                    
199      // Reset the size of the addr, which is only necessary for UNIX
                    
200      // domain sockets.
                    
201      if (new_stream.get_handle () != ACE_INVALID_HANDLE
                    
                
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>
                    
                
media_shout.erl git://github.com/2600hz/whistle.git | Erlang | 370 lines
                    
29	  ,media_id = <<>> :: binary()
                    
30	  ,lsocket = undefined :: undefined | port()
                    
31	  ,db = <<>> :: binary()
                    
136handle_info(timeout, #state{db=Db, doc=Doc, attachment=Attachment, media_name=MediaName, content_type=CType
                    
137			    ,lsocket=LSocket, send_to=SendTo, stream_type=StreamType}=S) ->
                    
138    {ok, PortNo} = inet:port(LSocket),
                    
156					    Self = self(),
                    
157					    spawn(fun() -> put(callid, CallID), start_shout_acceptor(Self, LSocket) end),
                    
158					    Url = list_to_binary(["shout://", net_adm:localhost(), ":", integer_to_list(PortNo), "/stream.mp3"]),
                    
203    ok = gen_tcp:controlling_process(Socket, MediaLoop),
                    
204    MediaLoop ! {add_socket, Socket},
                    
205    {noreply, S#state{media_loop = MediaLoop}, hibernate};
                    
207    ok = gen_tcp:controlling_process(Socket, MediaLoop),
                    
208    MediaLoop ! {add_socket, Socket},
                    
209    {noreply, S};
                    
                
test__examples.py https://code.google.com/p/gevent/ | Python | 280 lines
                    
13import gevent
                    
14from gevent import socket
                    
15import mysubprocess as subprocess
                    
106
                    
107if hasattr(socket, 'ssl'):
                    
108
                    
176        def test_client(message):
                    
177            conn = socket.create_connection(('127.0.0.1', 6000)).makefile(bufsize=1)
                    
178            welcome = conn.readline()
                    
183            conn._sock.settimeout(0.1)
                    
184            self.assertRaises(socket.timeout, conn.read, 1)
                    
185        client1 = gevent.spawn(test_client, 'hello\r\n')
                    
212        address = ('localhost', 9000)
                    
213        sock = socket.socket(type=socket.SOCK_DGRAM)
                    
214        sock.connect(address)
                    
                
os_socket.h git://github.com/insider42/mangos.git | C Header | 307 lines
                    
4/**
                    
5 *  @file    os_socket.h
                    
6 *
                    
6 *
                    
7 *  main sockets header
                    
8 *
                    
8 *
                    
9 *  $Id: os_socket.h 85015 2009-04-03 12:27:59Z johnnyw $
                    
10 *
                    
15
                    
16#ifndef ACE_OS_INCLUDE_SYS_OS_SOCKET_H
                    
17#define ACE_OS_INCLUDE_SYS_OS_SOCKET_H
                    
28
                    
29#if !defined (ACE_LACKS_SYS_SOCKET_H)
                    
30#  include /**/ <sys/socket.h>
                    
                
ColumnFamilyRecordWriter.java git://github.com/apache/cassandra.git | Java | 347 lines
                    
37import org.apache.thrift.TException;
                    
38import org.apache.thrift.transport.TSocket;
                    
39
                    
201        private Cassandra.Client thriftClient;
                    
202        private TSocket thriftSocket;
                    
203
                    
254        {
                    
255            if (thriftSocket != null)
                    
256            {
                    
256            {
                    
257                thriftSocket.close();
                    
258                thriftSocket = null;
                    
321                        InetAddress address = iter.next();
                    
322                        thriftSocket = new TSocket(address.getHostName(), ConfigHelper.getOutputRpcPort(conf));
                    
323                        thriftClient = ColumnFamilyOutputFormat.createAuthenticatedClient(thriftSocket, conf);
                    
                
antlr3input.h http://perseph.googlecode.com/svn/trunk/ | C Header | 224 lines
                    
57     *  Mostly this is just what is left in the pre-read buffer, but if the
                    
58     *  input source is a stream such as a socket or something then we may
                    
59     *  call special read code to wait for more input.
                    
                
MWReveal.java http://magicwars.googlecode.com/svn/trunk/ | Java | 358 lines
                    
33import mw.server.model.bean.CardBean;
                    
34import mw.server.socket.ZippedObjectImpl;
                    
35
                    
                
README.markdown git://github.com/nicolasff/webdis.git | Markdown | 356 lines
                    
63* Multi-threaded server, configurable number of worker threads.
                    
64* WebSocket support (Currently using the “hixie-76” specification).
                    
65* Connects to Redis using a TCP or UNIX socket.
                    
299# WebSockets
                    
300Webdis supports WebSocket clients implementing [dixie-76](http://tools.ietf.org/html/draft-hixie-thewebsocketprotocol-76).  
                    
301Web Sockets are supported with the following formats, selected by the connection URL:
                    
308function testJSON() {
                    
309	var jsonSocket = new WebSocket("ws://127.0.0.1:7379/.json");
                    
310	jsonSocket.onopen = function() {
                    
311
                    
312		console.log("JSON socket connected!");
                    
313		jsonSocket.send(JSON.stringify(["SET", "hello", "world"]));
                    
313		jsonSocket.send(JSON.stringify(["SET", "hello", "world"]));
                    
314		jsonSocket.send(JSON.stringify(["GET", "hello"]));
                    
315	};
                    
                
sys_oabi-compat.c git://github.com/torvalds/linux.git | C | 467 lines
                    
64 * sys_sendto:
                    
65 * sys_socketcall:
                    
66 *
                    
79#include <linux/sem.h>
                    
80#include <linux/socket.h>
                    
81#include <linux/net.h>
                    
439
                    
440asmlinkage long sys_oabi_socketcall(int call, unsigned long __user *args)
                    
441{
                    
462	default:
                    
463		r = sys_socketcall(call, args);
                    
464	}
                    
                
socket.cpp http://es-operating-system.googlecode.com/svn/trunk/ | C++ | 803 lines
                    
205
                    
206    SocketMessenger m(this, &SocketReceiver::atMark);
                    
207
                    
657    }
                    
658    SocketMessenger m(this, &SocketReceiver::isReadable);
                    
659    Visitor v(&m);
                    
670    }
                    
671    SocketMessenger m(this, &SocketReceiver::isWritable);
                    
672    Visitor v(&m);
                    
720
                    
721    SocketMessenger m(this, &SocketReceiver::notify);
                    
722    Visitor v(&m);
                    
773    }
                    
774    else if (strcmp(riid, es::MulticastSocket::iid()) == 0 && type == es::Socket::Datagram)
                    
775    {
                    
                
HdfsBroker.java http://hypertable.googlecode.com/svn/trunk/ | Java | 547 lines
                    
25import java.io.IOException;
                    
26import java.net.InetSocketAddress;
                    
27import java.nio.BufferUnderflowException;
                    
                
edit_destination.cgi git://github.com/webmin/webmin.git | Perl | 174 lines
                    
119
                    
120# TCP or UDP socket
                    
121$net = $tcp || $udp;
                    
141
                    
142# Datagram or stream socket
                    
143$unix = $dgram || $stream;
                    
153	   "</td> </tr>\n";
                    
154$dtable .= "<tr> <td>$text{'destination_socket'}</td> ".
                    
155	   "<td>".&ui_textbox("unix_name", $unix_name, 30)."\n".
                    
                
Bench2.cpp http://uftt.googlecode.com/svn/trunk/ | C++ | 266 lines
                    
86#if 0
                    
87		SOCKET sd = WSASocket(AF_IPX, SOCK_DGRAM, NSPROTO_IPX, 0, 0, 0);
                    
88		if (sd == SOCKET_ERROR) {
                    
105		if (WSAIoctl(sd, SIO_ADDRESS_LIST_QUERY, 0, 0, &SOCKET_ADDRESS_LIST,
                    
106				sizeof(SOCKET_ADDRESS_LIST), &nBytesReturned, 0, 0) == SOCKET_ERROR) {
                    
107			cout << "Failed calling WSAIoctl: error " << WSAGetLastError() <<
                    
116			if ((int)nep.capacity() <= SOCKET_ADDRESS_LIST.Address[i].iSockaddrLength)
                    
117				memcpy(nep.data(), &SOCKET_ADDRESS_LIST.Address[i], SOCKET_ADDRESS_LIST.Address[i].iSockaddrLength);
                    
118			boost::asio::ipx::address naddr = nep.getAddress();
                    
143	services::diskio_service diskio(service);
                    
144	proto::socket socket(service);
                    
145	boost::asio::deadline_timer timer(service);
                    
237	//socket.bind(proto::endpoint(boost::asio::ip::address_v4(), 33433));
                    
238	socket.set_option(proto::socket::broadcast(true));
                    
239
                    
                
Connection.cs git://github.com/IronLanguages/main.git | C# | 310 lines
                    
27        Server _server;
                    
28        Socket _socket;
                    
29        string _localServerIP;
                    
30
                    
31        internal Connection(Server server, Socket socket) {
                    
32            _server = server;
                    
32            _server = server;
                    
33            _socket = socket;
                    
34        }
                    
178                if (numBytes > 0) {
                    
179                    numReceived = _socket.Receive(buffer, 0, numBytes, SocketFlags.None);
                    
180                }
                    
285                    _socket.Poll(100000 /* 100ms */, SelectMode.SelectRead);
                    
286                    if (_socket.Available == 0 && _socket.Connected) {
                    
287                        _socket.Poll(30000000 /* 30sec */, SelectMode.SelectRead);
                    
                
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))
                    
                
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
                    
                
OChannelBinary.java http://orient.googlecode.com/svn/ | Java | 385 lines
                    
22import java.lang.reflect.InvocationTargetException;
                    
23import java.net.Socket;
                    
24import java.util.ArrayList;
                    
46
                    
47	public OChannelBinary(final Socket iSocket, final OContextConfiguration iConfig) throws IOException {
                    
48		super(iSocket, iConfig);
                    
                
nntplib.rst git://github.com/IronLanguages/main.git | ReStructuredText | 348 lines
                    
5.. module:: nntplib
                    
6   :synopsis: NNTP protocol client (requires sockets).
                    
7
                    
                
WipBrowserFactory.html http://chromedevtools.googlecode.com/svn/trunk/ | HTML | 266 lines
                    
152<CODE>&nbsp;<A HREF="../../../../org/chromium/sdk/wip/WipBrowser.html" title="interface in org.chromium.sdk.wip">WipBrowser</A></CODE></FONT></TD>
                    
153<TD><CODE><B><A HREF="../../../../org/chromium/sdk/wip/WipBrowserFactory.html#createBrowser(java.net.InetSocketAddress, org.chromium.sdk.wip.WipBrowserFactory.LoggerFactory)">createBrowser</A></B>(java.net.InetSocketAddress&nbsp;socketAddress,
                    
154              <A HREF="../../../../org/chromium/sdk/wip/WipBrowserFactory.LoggerFactory.html" title="interface in org.chromium.sdk.wip">WipBrowserFactory.LoggerFactory</A>&nbsp;connectionLoggerFactory)</CODE>
                    
191
                    
192<A NAME="createBrowser(java.net.InetSocketAddress, org.chromium.sdk.wip.WipBrowserFactory.LoggerFactory)"><!-- --></A><H3>
                    
193createBrowser</H3>
                    
194<PRE>
                    
195<A HREF="../../../../org/chromium/sdk/wip/WipBrowser.html" title="interface in org.chromium.sdk.wip">WipBrowser</A> <B>createBrowser</B>(java.net.InetSocketAddress&nbsp;socketAddress,
                    
196                         <A HREF="../../../../org/chromium/sdk/wip/WipBrowserFactory.LoggerFactory.html" title="interface in org.chromium.sdk.wip">WipBrowserFactory.LoggerFactory</A>&nbsp;connectionLoggerFactory)</PRE>
                    
                
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
                    
                
EvDns.d http://gool.googlecode.com/svn/trunk/ | D | 232 lines
                    
98struct nameserver {
                    
99	evutil_socket_t		socket;	 /* a connected UDP socket */
                    
100	sockaddr_storage		address;
                    
109	char				state;  /* zero if we think that this server is down */
                    
110	char				choked;  /* true if we have an EAGAIN from this server's socket */
                    
111	char				write_waiting;  /* true if we are waiting for EV_WRITE events */
                    
116struct evdns_server_port {
                    
117	evutil_socket_t	socket; /* socket we use to read queries and write replies. */
                    
118	int			refcnt; /* reference count. */
                    
                
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)
                    
                
mythcorecontext.h git://github.com/MythTV/mythtv.git | C Header | 281 lines
                    
62    void SetServerSocket(MythSocket *serverSock);
                    
63    void SetEventSocket(MythSocket *eventSock);
                    
64    void SetScheduler(MythScheduler *sched);
                    
76
                    
77    MythSocket *ConnectEventSocket(const QString &hostname, int port);
                    
78
                    
78
                    
79    bool SetupCommandSocket(MythSocket *serverSock, const QString &announcement,
                    
80                            uint timeout_in_ms, bool &proto_mismatch);
                    
81
                    
82    bool CheckProtoVersion(MythSocket *socket,
                    
83                           uint timeout_ms = kMythSocketLongTimeout,
                    
198                                  bool keepscope = false) ;
                    
199    bool CheckSubnet(const QAbstractSocket *socket);
                    
200    bool CheckSubnet(const QHostAddress &peer);
                    
                
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	}
                    
                
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(
                    
                
privsep.c https://code.google.com/p/pdsh/ | C | 339 lines
                    
35
                    
36#include <sys/socket.h>
                    
37#include <sys/wait.h>
                    
84
                    
85static int create_socketpair (void)
                    
86{
                    
88
                    
89	if (socketpair (AF_UNIX, SOCK_STREAM, 0, pfds) < 0) {
                    
90		err ("%p: socketpair failed in privilege separation: %m\n");
                    
147	} else {
                    
148		cmsg->cmsg_level   = SOL_SOCKET;
                    
149		cmsg->cmsg_type    = SCM_RIGHTS;
                    
186#else /* !HAVE_MSGHDR_ACCRIGHTS */
                    
187	cmsg->cmsg_level   = SOL_SOCKET;
                    
188	cmsg->cmsg_type    = SCM_RIGHTS;
                    
                
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();
                    
                
config.h https://openjade.svn.sourceforge.net/svnroot/openjade | C Header | 262 lines
                    
166// takes ages to compile and creates core dumping executables!
                    
167// I havn't tried the socket stuff.
                    
168// <Chris_Paulson-Ellis@3mail.3com.com>
                    
                
id.po.in git://git.savannah.gnu.org/gsasl.git | Autoconf | 249 lines
                    
50#, c-format
                    
51msgid "Cannot initialize Windows sockets."
                    
52msgstr "Tidak dapat menginisialisasi soket Windows."
                    
                
namespace.test.js git://github.com/nowelium/socket.io-titanium.git | JavaScript | 286 lines
                    
53      })
                    
54      .on('connection', function (socket) {
                    
55        cl.end();
                    
96    cl.handshake(function (sid) {
                    
97      ws = websocket(cl, sid);
                    
98      ws.on('open', function () {
                    
116      })
                    
117      .on('connection', function (socket) {
                    
118        throw new Error('Should not be called');
                    
256
                    
257    io.sockets.on('connection', function (socket) {
                    
258      socket.on('foobar', function () {
                    
263    cl.handshake(function (sid) {
                    
264      ws = websocket(cl, sid);
                    
265
                    
                
pserver.cc https://octave.svn.sourceforge.net/svnroot/octave | C++ | 592 lines
                    
291      if(sock==-1){
                    
292	perror("socket ");
                    
293	int len=118;
                    
381	      ol=sizeof(val);
                    
382	      setsockopt(asock,SOL_SOCKET,SO_REUSEADDR,&val,ol);
                    
383	      
                    
420		  setsockopt(dasock,SOL_SOCKET,SO_SNDBUF,&bufsize,ol);
                    
421		  setsockopt(dasock,SOL_SOCKET,SO_RCVBUF,&bufsize,ol);
                    
422		  bufsize=1;
                    
423		  ol=sizeof(bufsize);
                    
424		  setsockopt(dasock,SOL_SOCKET,SO_REUSEADDR,&bufsize,ol);
                    
425		  
                    
553	      for(i=1;i<=num_nodes;i++){
                    
554		sprintf(s,"sockets=[sockets;%d,0,%d]",sock_v[i+2*(num_nodes+1)]);
                    
555		eval_string(std::string(s),true,stat);
                    
                
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
                    
                
ScribeHandler.scala git://github.com/twitter/util.git | Scala | 449 lines
                    
154
                    
155  private var socket: Option[Socket] = None
                    
156
                    
181            lastConnectAttempt = Time.now
                    
182            socket = Some(new Socket(hostname, port))
                    
183
                    
199
                    
200      serverType = socket match {
                    
201        case None => Unknown
                    
258                          category, count, hostname, port)
                    
259                closeSocket()
                    
260            }
                    
267
                    
268    def readResponseExpecting(socket: Socket, expectedReply: Array[Byte]): Unit = {
                    
269      var offset = 0
                    
                
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)
                    
                
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())));
                    
                
socket_base.hpp http://hadesmem.googlecode.com/svn/trunk/ | C++ Header | 0 lines
                    
185   * @code
                    
186   * boost::asio::ip::tcp::socket socket(io_service); 
                    
187   * ...
                    
403   * @par Concepts:
                    
404   * Socket_Option, Linger_Socket_Option.
                    
405   */
                    
438   * @par Concepts:
                    
439   * Socket_Option, Boolean_Socket_Option.
                    
440   */
                    
456   * @code
                    
457   * boost::asio::ip::tcp::socket socket(io_service); 
                    
458   * ...
                    
478   * @code
                    
479   * boost::asio::ip::tcp::socket socket(io_service); 
                    
480   * ...
                    
                
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}
                    
                
Proxy.cs git://github.com/koush/androidmono.git | C# | 142 lines
                    
105		internal static global::MonoJavaBridge.MethodId _address13731;
                    
106		public virtual global::java.net.SocketAddress address() 
                    
107		{
                    
109			if (!IsClrObject)
                    
110				return global::MonoJavaBridge.JavaBridge.WrapJavaObject(@__env.CallObjectMethod(this.JvmHandle, global::java.net.Proxy._address13731)) as java.net.SocketAddress;
                    
111			else
                    
111			else
                    
112				return global::MonoJavaBridge.JavaBridge.WrapJavaObject(@__env.CallNonVirtualObjectMethod(this.JvmHandle, global::java.net.Proxy.staticClass, global::java.net.Proxy._address13731)) as java.net.SocketAddress;
                    
113		}
                    
114		internal static global::MonoJavaBridge.MethodId _Proxy13732;
                    
115		public Proxy(java.net.Proxy.Type arg0, java.net.SocketAddress arg1)  : base(global::MonoJavaBridge.JNIEnv.ThreadEnv) 
                    
116		{
                    
136			global::java.net.Proxy._hashCode13730 = @__env.GetMethodIDNoThrow(global::java.net.Proxy.staticClass, "hashCode", "()I");
                    
137			global::java.net.Proxy._address13731 = @__env.GetMethodIDNoThrow(global::java.net.Proxy.staticClass, "address", "()Ljava/net/SocketAddress;");
                    
138			global::java.net.Proxy._Proxy13732 = @__env.GetMethodIDNoThrow(global::java.net.Proxy.staticClass, "<init>", "(Ljava/net/Proxy$Type;Ljava/net/SocketAddress;)V");
                    
                
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.
                    
                
WidcommBluetoothFactory.cs https://32feet.svn.codeplex.com/svn | C# | 367 lines
                    
10using System.Text;
                    
11using InTheHand.Net.Sockets;
                    
12using System.Diagnostics;
                    
241
                    
242        protected override IBluetoothClient GetBluetoothClient(System.Net.Sockets.Socket acceptedSocket)
                    
243        {
                    
243        {
                    
244            throw new NotSupportedException("Cannot create a BluetoothClient from a Socket on the Widcomm stack.");
                    
245        }
                    
                
IrServerApplet.lua http://irserversb.googlecode.com/svn/trunk/ | Lua | 523 lines
                    
67
                    
68local socket = require("socket")
                    
69local os = require("os")
                    
291	-- load namespace
                    
292	-- create a TCP socket and bind it to the local host, at any port
                    
293	server = socket.bind("*", 8174)
                    
                
parallel.py git://git.savannah.nongnu.org/par.git | Python | 331 lines
                    
32
                    
33import commands, os, socket, subprocess, sys, tempfile, time, thread
                    
34import Pyro.core, Pyro.naming
                    
                
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) ->
                    
                
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>
                    
                
ChatServlet.java http://jquery-stream.googlecode.com/svn/ | Java | 202 lines
                    
24import org.eclipse.jetty.websocket.WebSocket;
                    
25import org.eclipse.jetty.websocket.WebSocketServlet;
                    
26
                    
54					}
                    
55					for (ChatWebSocket webSocket : webSockets) {
                    
56						try {
                    
58						} catch (Exception e) {
                    
59							webSockets.remove(webSocket);
                    
60						}
                    
161	/* WebSocket powered by Jetty */
                    
162	private Queue<ChatWebSocket> webSockets = new ConcurrentLinkedQueue<ChatWebSocket>();
                    
163
                    
164	@Override
                    
165	public WebSocket doWebSocketConnect(HttpServletRequest request, String protocol) {
                    
166		return new ChatWebSocket();
                    
                
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
                    
                
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
                    
                
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'
                    
                
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
                    
                
edit-server.el https://bitbucket.org/yinwm/usemacs/ | Emacs Lisp | 359 lines
                    
5;; Emacs Chrome plugin. This is my first attempt at doing something
                    
6;; with sockets in Emacs. I based it on the following examples:
                    
7;;
                    
120
                    
121;; Edit Server socket code
                    
122;
                    
                
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) { 
                    
                
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
                    
                
libxt_TEE.c http://droidwall.googlecode.com/svn/trunk/ | C | 0 lines
                    
10 */
                    
11#include <sys/socket.h>
                    
12#include <getopt.h>
                    
                
websocket.coffee git://github.com/stephank/orona.git | CoffeeScript | 0 lines
                    
1# This is an extract from Socket.IO-node.
                    
2#
                    
49
                    
50    # Delegate socket methods and events.
                    
51    @connection.on 'end', => @_onEnd()
                    
60    # Get the keys.
                    
61    k1 = @request.headers['sec-websocket-key1']
                    
62    k2 = @request.headers['sec-websocket-key2']
                    
88      'HTTP/1.1 101 WebSocket Protocol Handshake',
                    
89      'Upgrade: WebSocket',
                    
90      'Connection: Upgrade',
                    
90      'Connection: Upgrade',
                    
91      'Sec-WebSocket-Origin: ' + (origin || 'null'),
                    
92      'Sec-WebSocket-Location: ws://' + @request.headers.host + @request.url
                    
94    if 'sec-websocket-protocol' in @request.headers
                    
95      headers.push('Sec-WebSocket-Protocol: ' + @request.headers['sec-websocket-protocol'])
                    
96    headers = headers.concat('', '').join('\r\n')
                    
                
config.lua http://ibus-sogoupycc.googlecode.com/svn/trunk/ | Lua | 84 lines
                    
4-- ?? luasocket ??
                    
5http, url = require('socket.http'), require('socket.url')
                    
6
                    
                
net_mp.c https://quake.svn.sourceforge.net/svnroot/quake | C | 480 lines
                    
108
                    
109	if ((net_controlsocket = MPATH_OpenSocket (0)) == -1)
                    
110		Sys_Error ("MPATH_Init: Unable to open control socket\n");
                    
191		net_broadcastsocket = 0;
                    
192	return closesocket (socket);
                    
193}
                    
317
                    
318	if (socket != net_broadcastsocket) {
                    
319		if (net_broadcastsocket != 0)
                    
320			Sys_Error ("Attempted to use multiple broadcasts sockets\n");
                    
321		ret = MPATH_MakeSocketBroadcastCapable (socket);
                    
322		if (ret == -1) {
                    
385int
                    
386MPATH_GetSocketAddr (int socket, struct qsockaddr *addr)
                    
387{
                    
                
ModClusterSubsystemXMLReader_1_0.java git://github.com/jbossas/jboss-as.git | Java | 295 lines
                    
107            switch (attribute) {
                    
108                case ADVERTISE_SOCKET:
                    
109                case PROXY_LIST:
                    
115                case STOP_CONTEXT_TIMEOUT:
                    
116                case SOCKET_TIMEOUT:
                    
117                case STICKY_SESSION:
                    
                
AbstractWsConnection.java http://chromedevtools.googlecode.com/svn/trunk/ | Java | 317 lines
                    
29  private static final Logger LOGGER = Logger.getLogger(Hybi00WsConnection.class.getName());
                    
30  private final AbstractSocketWrapper<INPUT, OUTPUT> socketWrapper;
                    
31  private final ConnectionLogger connectionLogger;
                    
42
                    
43  protected AbstractWsConnection(AbstractSocketWrapper<INPUT, OUTPUT> socketWrapper,
                    
44      ConnectionLogger connectionLogger) {
                    
44      ConnectionLogger connectionLogger) {
                    
45    this.socketWrapper = socketWrapper;
                    
46    this.connectionLogger = connectionLogger;
                    
47    try {
                    
48      linkedCloser.bind(socketWrapper.getShutdownRelay(), null, SOCKET_TO_CONNECTION);
                    
49    } catch (AlreadySignalledException e) {
                    
188
                    
189  protected AbstractSocketWrapper<INPUT, OUTPUT> getSocketWrapper() {
                    
190    return socketWrapper;
                    
                
HowToCreateP2P.pas http://swingamesdk.googlecode.com/svn/trunk/ | Pascal | 198 lines
                    
82begin
                    
83  CloseAllTCPReceiverSocket();
                    
84  CloseAllTCPHostSocket();
                    
86  LabelSetText('HostLbl', 'Connect');
                    
87  ListAddItem(aMenuPanel, 'MsgList',  'Listening Sockets Closed.');
                    
88  aStatus := False;
                    
93  BroadcastTCPMessage('[ClientDisconnect]');
                    
94  CloseAllTCPSenderSocket();
                    
95  LabelSetText('ClientStatusVal', 'Disconnected');
                    
113    begin
                    
114      CloseTCPReceiverSocket(GetIPFromMessage(), GetPortFromMessage());
                    
115      ListAddItem(aMenuPanel, 'MsgList',  GetIPFromMessage() + ' Disconnected.');
                    
                
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;
                    
                
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. 
                    
                
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			}
                    
                
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{
                    
                
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"
                    
                
AddressDiagnosticsKit.java http://gophone.googlecode.com/svn/trunk/ | Java | 387 lines
                    
207            {
                    
208                if (ex.getCause() instanceof SocketException
                    
209                    && i < bindRetries)
                    
                
devip.c https://bitbucket.org/rsc/drawterm/ | C | 794 lines
                    
394	if(c->sfd == -1)
                    
395		c->sfd = so_socket(c->p->stype, c->laddr);
                    
396
                    
484			if(c->sfd == -1)
                    
485				c->sfd = so_socket(c->p->stype, c->raddr);
                    
486			so_connect(c->sfd, c->raddr, c->rport);
                    
                
ConstantRatePushStreamGenerator.java http://snee.googlecode.com/svn/trunk/ | Java | 360 lines
                    
93	 */
                    
94	Map<String, MulticastSocket> sockets =
                    
95		new HashMap<String, MulticastSocket>();
                    
177			socket.joinGroup(InetAddress.getByName(source.getHost()));
                    
178			sockets.put(streamName, socket);
                    
179		} catch (IOException e) {
                    
198		task.streamName = streamName;
                    
199		MulticastSocket socket = sockets.get(streamName);
                    
200		if (logger.isTraceEnabled())
                    
201			logger.trace("Socket: " + socket);
                    
202		task.mcSocket = socket;
                    
203		String hostAddress = udpSource.getHost();
                    
282		private int curIndex = 0;
                    
283		private MulticastSocket mcSocket;
                    
284		private String streamName;
                    
                
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
                    
                
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 */
                    
                
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>
                    
                
sercd.h http://android-serialport-api.googlecode.com/svn/trunk/ | C Header | 183 lines
                    
150int SercdSelect(PORTHANDLE *DeviceIn, PORTHANDLE *DeviceOut, PORTHANDLE *Modemstate,
                    
151                SERCD_SOCKET *SocketOut, SERCD_SOCKET *SocketIn,
                    
152                SERCD_SOCKET *SocketConnect, long PollInterval);
                    
154#define SERCD_EV_DEVICEOUT 2
                    
155#define SERCD_EV_SOCKETOUT 4
                    
156#define SERCD_EV_SOCKETIN 8
                    
167
                    
168void NewListener(SERCD_SOCKET LSocketFd);
                    
169#ifndef ANDROID
                    
169#ifndef ANDROID
                    
170void DropConnection(PORTHANDLE * DeviceFd, SERCD_SOCKET * InSocketFd, SERCD_SOCKET * OutSocketFd, 
                    
171                    const char *LockFileName);
                    
172#else
                    
173void DropConnection(PORTHANDLE * DeviceFd, SERCD_SOCKET * InSocketFd, SERCD_SOCKET * OutSocketFd);
                    
174#endif
                    
                
memdebug.h git://github.com/bagder/curl.git | C Header | 174 lines
                    
52/* file descriptor manipulators */
                    
53CURL_EXTERN curl_socket_t curl_dbg_socket(int domain, int type, int protocol,
                    
54                                          int line, const char *source);
                    
58                                int line, const char *source);
                    
59CURL_EXTERN curl_socket_t curl_dbg_accept(curl_socket_t s, void *a, void *alen,
                    
60                                          int line, const char *source);
                    
60                                          int line, const char *source);
                    
61#ifdef HAVE_SOCKETPAIR
                    
62CURL_EXTERN int curl_dbg_socketpair(int domain, int type, int protocol,
                    
62CURL_EXTERN int curl_dbg_socketpair(int domain, int type, int protocol,
                    
63                                    curl_socket_t socket_vector[2],
                    
64                                    int line, const char *source);
                    
117#define socketpair(domain,type,protocol,socket_vector)\
                    
118 curl_dbg_socketpair(domain, type, protocol, socket_vector, __LINE__, __FILE__)
                    
119#endif
                    
                
ipx_route.c git://github.com/CyanogenMod/cm-kernel.git | C | 294 lines
                    
23extern struct ipx_interface *ipxitf_find_using_net(__be32 net);
                    
24extern int ipxitf_demux_socket(struct ipx_interface *intrfc,
                    
25			       struct sk_buff *skb, int copy);
                    
25			       struct sk_buff *skb, int copy);
                    
26extern int ipxitf_demux_socket(struct ipx_interface *intrfc,
                    
27			       struct sk_buff *skb, int copy);
                    
167/*
                    
168 * Route an outgoing frame from a socket.
                    
169 */
                    
                
TestLogRollAbort.java git://github.com/apache/hbase.git | Java | 174 lines
                    
79    TEST_UTIL.getConfiguration().setInt("ipc.ping.interval", 10 * 1000);
                    
80    TEST_UTIL.getConfiguration().setInt("ipc.socket.timeout", 10 * 1000);
                    
81    TEST_UTIL.getConfiguration().setInt("hbase.rpc.timeout", 10 * 1000);
                    
                
SimpleXMLRPCServer.SimpleXMLRPCServer-class.html http://hornerp.googlecode.com/svn/trunk/ | HTML | 280 lines
                    
60<pre class="base-tree">
                    
61SocketServer.BaseServer --+    
                    
62                          |    
                    
62                          |    
                    
63     SocketServer.TCPServer --+
                    
64                              |
                    
118    <td colspan="2" class="summary">
                    
119    <p class="indent-wrapped-lines"><b>Inherited from <code>SocketServer.TCPServer</code></b>:
                    
120      <code>close_request</code>,
                    
126      </p>
                    
127    <p class="indent-wrapped-lines"><b>Inherited from <code>SocketServer.BaseServer</code></b>:
                    
128      <code>finish_request</code>,
                    
177    <td colspan="2" class="summary">
                    
178    <p class="indent-wrapped-lines"><b>Inherited from <code>SocketServer.TCPServer</code></b>:
                    
179      <code>address_family</code>,
                    
                
test_socketserver.py git://github.com/IronLanguages/main.git | Python | 284 lines
                    
26
                    
27HAVE_UNIX_SOCKETS = hasattr(socket, "AF_UNIX")
                    
28HAVE_FORKING = hasattr(os, "fork") and os.name != "os2"
                    
43    class ForkingUnixStreamServer(SocketServer.ForkingMixIn,
                    
44                                  SocketServer.UnixStreamServer):
                    
45        pass
                    
156    def stream_examine(self, proto, addr):
                    
157        s = socket.socket(proto, socket.SOCK_STREAM)
                    
158        s.connect(addr)
                    
167    def dgram_examine(self, proto, addr):
                    
168        s = socket.socket(proto, socket.SOCK_DGRAM)
                    
169        s.sendto(TEST_STR, addr)
                    
189            with simple_subprocess(self):
                    
190                self.run_server(SocketServer.ForkingTCPServer,
                    
191                                SocketServer.StreamRequestHandler,
                    
                
http.lua http://luaxyssl.googlecode.com/svn/trunk/ | Lua | 352 lines
                    
10-------------------------------------------------------------------------------
                    
11local socket = require("socket")
                    
12local url = require("socket.url")
                    
27-- user agent field sent in request
                    
28USERAGENT = socket._VERSION
                    
29
                    
41        -- get field-name and value
                    
42        name, value = socket.skip(2, string.find(line, "^(.-):%s*(.*)"))
                    
43        if not (name and value) then return nil, "malformed reponse headers" end
                    
111    -- create socket with user connect function, or with default
                    
112    local c = socket.try((create or socket.tcp)(scheme))
                    
113    local h = base.setmetatable({ c = c }, metat)
                    
142    if headers["content-length"] then mode = "keep-open" end
                    
143    return self.try(ltn12.pump.all(source, socket.sink(mode, self.c), step))
                    
144end
                    
                
connection.hpp http://suckerserv.googlecode.com/svn/trunk/ | C++ Header | 359 lines
                    
77    {
                    
78        boost::asio::async_write(m_socket, boost::asio::buffer(data), boost::asio::transfer_at_least(data.length()), bind_io_handler(&connection::send_complete<CompletionHandler>, handler));
                    
79    }
                    
120    {
                    
121        return m_socket.is_open();   
                    
122    }
                    
194
                    
195        boost::asio::async_read(m_socket, m_read_buffer, 
                    
196            boost::asio::transfer_at_least(std::min(remaining, m_receive_buffer_size)), 
                    
338    boost::system::error_code m_send_error;
                    
339    boost::asio::ip::tcp::socket & m_socket;
                    
340    std::size_t m_receive_buffer_size;
                    
350    client_connection(boost::asio::io_service & service)
                    
351     :boost::asio::ip::tcp::socket(service), connection(*static_cast<boost::asio::ip::tcp::socket *>(this)){}
                    
352};
                    
                
Server.vala http://libzee.googlecode.com/svn/trunk/ | Vala | 215 lines
                    
55		 */
                    
56		protected InetSocketAddress					 _address;
                    
57		/**
                    
57		/**
                    
58		 * Server's socket service
                    
59		 */
                    
59		 */
                    
60		protected ThreadedSocketService  			 _service;
                    
61		
                    
90			
                    
91			this._address = new InetSocketAddress(addr, port);
                    
92			this._max_threads = max_threads;
                    
135			// [TODO]: Wrap the generic GLib error
                    
136			this._service.add_address(this._address, SocketType.STREAM, SocketProtocol.TCP, null, null);
                    
137			
                    
                
config-linux-common.h git://github.com/TrinityCore/TrinityCore.git | C++ Header | 439 lines
                    
90  // ACE_POSIX_SIG_Proactor is the only chance of getting asynch I/O working.
                    
91  // There are restrictions, such as all socket operations being silently
                    
92  // converted to synchronous by the kernel, that make aio a non-starter
                    
282
                    
283// Linux defines struct msghdr in /usr/include/socket.h
                    
284#define ACE_HAS_MSG
                    
290
                    
291#define ACE_DEFAULT_MAX_SOCKET_BUFSIZ 65535
                    
292
                    
                
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        }
                    
                
mach-gta02.c git://github.com/CyanogenMod/cm-kernel.git | C | 581 lines
                    
147 * On GTA02 the 1A charger features a 48K resistor to 0V on the ID pin.
                    
148 * We use this to recognize that we can pull 1A from the USB socket.
                    
149 *
                    
                
config-riscos.h git://github.com/bagder/curl.git | C Header | 504 lines
                    
79
                    
80/* Define this to your Entropy Gathering Daemon socket pathname */
                    
81#undef EGD_SOCKET
                    
94
                    
95/* Define if you have the `closesocket' function. */
                    
96#undef HAVE_CLOSESOCKET
                    
172
                    
173/* Define if you have the `socket' library (-lsocket). */
                    
174#undef HAVE_LIBSOCKET
                    
265
                    
266/* Define if you have the `socket' function. */
                    
267#define HAVE_SOCKET
                    
316
                    
317/* Define if you have the <sys/socket.h> header file. */
                    
318#define HAVE_SYS_SOCKET_H
                    
                
Stomp.as http://as3-stomp.googlecode.com/svn/trunk/ | ActionScript | 490 lines
                    
50		
                    
51    	private var socket : Socket;
                    
52 		
                    
70	
                    
71		public function connect( server : String = "localhost", port : int = 61613, connectHeaders : ConnectHeaders = null, socket: Socket = null) : void 
                    
72		{
                    
75			this.connectHeaders = connectHeaders;
                    
76			this.socket = socket || new Socket();
                    
77			
                    
110	  		socket.addEventListener( Event.CLOSE, onClose );
                    
111      		socket.addEventListener( ProgressEvent.SOCKET_DATA, onData );
                    
112			socket.addEventListener( IOErrorEvent.IO_ERROR, onError );
                    
310	    		buffer.length = 0;
                    
311	    	socket.readBytes(buffer, buffer.length, socket.bytesAvailable);
                    
312	    	while (buffer.bytesAvailable > 0 && processFrame()) {
                    
                
netdb.d git://github.com/dsimcha/druntime.git | D | 414 lines
                    
20public import core.sys.posix.sys.types;   // for ino_t
                    
21public import core.sys.posix.sys.socket;  // for socklen_t
                    
22
                    
                
NetworkStreamSender.java git://github.com/bigbluebutton/bigbluebutton.git | Java | 303 lines
                    
47    private final boolean useSVC2;
                    
48    private NetworkSocketStreamSender[] socketSenders;
                    
49    private NetworkHttpStreamSender[] httpSenders;
                    
90		try {
                    
91			Socket socket = new Socket();
                    
92			InetSocketAddress endpoint = new InetSocketAddress(host, port);
                    
111		if ((port != 0) && trySocketConnection(host, port)) {
                    
112			socketSenders = new NetworkSocketStreamSender[numThreads];
                    
113			for (int i = 0; i < numThreads; i++) {
                    
117				} catch (ConnectionException e) {
                    
118					System.out.println("Failed to connect using socket.");
                    
119				}
                    
153	private void createSender(int i) throws ConnectionException {
                    
154		socketSenders[i] = new NetworkSocketStreamSender(i, this, room, screenDim, blockDim, seqNumGenerator, useSVC2);
                    
155		socketSenders[i].addListener(this);
                    
                
eclipse.php https://bitbucket.org/chamilo/chamilo/ | PHP | 307 lines
                    
13include_once 'invoker.php';
                    
14include_once 'socket.php';
                    
15include_once 'mock_objects.php';
                    
52     *    @param string $host       Normally localhost.
                    
53     *    @return SimpleSocket      Connection to Eclipse.
                    
54     */
                    
55    function &createListener($port, $host="127.0.0.1"){
                    
56        $tmplistener = &new SimpleSocket($host, $port, 5);
                    
57        return $tmplistener;
                    
                
getifaddrs.c http://newcnix.googlecode.com/svn/trunk/ | C | 402 lines
                    
40#include <sys/ioctl.h>
                    
41#include <sys/socket.h>
                    
42#include <net/if.h>
                    
67/*
                    
68 * On systems with a routing socket, ALIGNBYTES should match the value
                    
69 * that the kernel uses when building the messages.
                    
205
                    
206	if ((sock = socket(AF_INET, SOCK_STREAM, 0)) < 0)
                    
207		return (-1);
                    
                
FileAssertTests.cs git://github.com/shouldly/shouldly.git | C# | 437 lines
                    
9using System.Reflection;
                    
10using System.Net.Sockets;
                    
11
                    
                
inet_net_pton.c git://github.com/postgres/postgres-old-soon-decommissioned.git | C | 564 lines
                    
26#include <sys/types.h>
                    
27#include <sys/socket.h>
                    
28#include <netinet/in.h>
                    
                
 

Source

Language