100+ results results for 'socket repo:fdroid/androidpinning' (293 ms)
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 }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 largeSocketStream.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 }fake.php https://code.google.com/p/php-blackops-rcon/ | PHP | 546 lines
30 /** 31 * Socket res 32 * 34 */ 35 protected $socket = NULL; 36 103 { 104 //fclose($this->socket); 105 } 118 /** 119 * Get socket resource 120 * 122 */ 123 public function get_socket() 124 {HttpClientService.java http://andrico.googlecode.com/svn/trunk/ | Java | 354 lines
40import org.apache.http.conn.ClientConnectionManager; 41import org.apache.http.conn.scheme.PlainSocketFactory; 42import org.apache.http.conn.scheme.Scheme; 43import org.apache.http.conn.scheme.SchemeRegistry; 44import org.apache.http.conn.scheme.SocketFactory; 45import org.apache.http.entity.mime.MultipartEntity; 186 // by the default operator to look up socket factories. 187 final SocketFactory sf = PlainSocketFactory.getSocketFactory(); 188 supportedSchemes.register(new Scheme("http", sf, 80));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)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;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 Flextest_xspec.py https://bitbucket.org/hpk42/execnet/ | Python | 245 lines
13 def test_norm_attributes(self): 14 spec = XSpec("socket=192.168.102.2:8888//python=c:/this/python2.5" 15 "//chdir=d:\hello") 15 "//chdir=d:\hello") 16 assert spec.socket == "192.168.102.2:8888" 17 assert spec.python == "c:/this/python2.5" 23 24 spec = XSpec("socket=192.168.102.2:8888//python=python2.5//nice=3") 25 assert spec.socket == "192.168.102.2:8888" 219 def test_socket(self, specsocket, makegateway): 220 gw = makegateway("socket=%s//id=sock1" % specsocket.socket) 221 rinfo = gw._rinfo() 229 def test_socket_second(self, specsocket, makegateway): 230 gw = makegateway("socket=%s//id=sock1" % specsocket.socket) 231 gw2 = makegateway("socket=%s//id=sock1" % specsocket.socket)mysqli_driver.php git://github.com/EllisLab/CodeIgniter.git | PHP | 540 lines
118 { 119 // Do we have a socket path? 120 if ($this->hostname[0] === '/') 123 $port = NULL; 124 $socket = $this->hostname; 125 } 130 $port = empty($this->port) ? NULL : $this->port; 131 $socket = NULL; 132 } 202 203 if ($this->_mysqli->real_connect($hostname, $this->username, $this->password, $this->database, $port, $socket, $client_flags)) 204 {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 }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(w.c https://bitbucket.org/freebsd/freebsd-head/ | C | 529 lines
56#include <sys/ioctl.h> 57#include <sys/socket.h> 58#include <sys/tty.h>sys_procdesc.c https://bitbucket.org/freebsd/freebsd-head/ | C | 533 lines
42 * references to that descriptor may be held from many processes (or even 43 * be in flight between processes over a local domain socket). 44 * - Last close on the process descriptor will terminate the process usingTCPTransportClient.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 }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>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) { 216beos.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; } 113TcpServer.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" 118AbstractClient.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);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#endifdebugger.c git://github.com/bmeurer/ocaml.git | C | 439 lines
85 86static int dbg_socket = -1; /* The socket connected to the debugger */ 87static struct channel * dbg_in; /* Input channel on the socket */ 99 oldvaluelen = sizeof(oldvalue); 100 retcode = getsockopt(INVALID_SOCKET, SOL_SOCKET, SO_OPENTYPE, 101 (char *) &oldvalue, &oldvaluelen); 107#endif 108 dbg_socket = socket(sock_domain, SOCK_STREAM, 0); 109#ifdef _WIN32 111 /* Restore initial mode */ 112 setsockopt(INVALID_SOCKET, SOL_SOCKET, SO_OPENTYPE, 113 (char *) &oldvalue, oldvaluelen); 121#ifdef _WIN32 122 dbg_socket = _open_osfhandle(dbg_socket, 0); 123 if (dbg_socket == -1)ListenSocket.h https://bitbucket.org/oregon/oregoncore/ | C Header | 0 lines
29*/ 30#ifndef _SOCKETS_ListenSocket_H 31#define _SOCKETS_ListenSocket_H 63 \param use_creator Optional use of creator (default true) */ 64 ListenSocket(ISocketHandler& h,bool use_creator = true) : Socket(h), m_depth(0), m_creator(NULL) 65 ,m_bHasCreate(false) 392 "accept()" is handled automatically in the OnRead() method. */ 393 virtual SOCKET Accept(SOCKET socket, struct sockaddr *saptr, socklen_t *lenptr) 394 { 404protected: 405 ListenSocket(const ListenSocket& s) : Socket(s) {} 406private: 406private: 407 ListenSocket& operator=(const ListenSocket& ) { return *this; } 408 int m_depth;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.violite.h https://code.google.com/p/oregoncore/ | C++ Header | 242 lines
38{ 39 VIO_CLOSED, VIO_TYPE_TCPIP, VIO_TYPE_SOCKET, VIO_TYPE_NAMEDPIPE, 40 VIO_TYPE_SSL, VIO_TYPE_SHARED_MEMORY 47 48Vio* vio_new(my_socket sd, enum enum_vio_type type, uint flags); 49#ifdef __WIN__ 64void vio_reset(Vio* vio, enum enum_vio_type type, 65 my_socket sd, HANDLE hPipe, uint flags); 66size_t vio_read(Vio *vio, uchar * buf, size_t size); 115/* Set yaSSL to use same type as MySQL do for socket handles */ 116typedef my_socket YASSL_SOCKET_T; 117#define YASSL_SOCKET_T_DEFINED 189{ 190 my_socket sd; /* my_socket - real or imaginary */ 191 HANDLE hPipe;Netcache.java https://code.google.com/p/waf/ | Java | 280 lines
26 private final static HashMap<String, Object[]> flist = new HashMap<String, Object[]>(); 27 private Socket sock = null; 28 private int port = 0; 29 30 public Netcache(Socket sock, int port) { 31 this.sock = sock; 74 // magic trick to avoid creating a new inner class 75 ServerSocket server = new ServerSocket(port); 76 server.setReuseAddress(true);BridgeTest.as git://github.com/benbjohnson/melomel.git | ActionScript | 217 lines
108 bridge.connect(); 109 socket = (bridge as MockBridge).getSocket() as MockXMLSocket; 110 Async.proceedOnEvent(this, socket, "send"); 146 bridge.connect(); 147 socket = (bridge as MockBridge).getSocket() as MockXMLSocket; 148 Async.proceedOnEvent(this, socket, "send"); 165 bridge.connect(); 166 socket = (bridge as MockBridge).getSocket() as MockXMLSocket; 167 Async.proceedOnEvent(this, socket, "send"); 180 bridge.connect(); 181 socket = (bridge as MockBridge).getSocket() as MockXMLSocket; 182 Async.proceedOnEvent(this, socket, "send"); 199 bridge.connect(); 200 socket = (bridge as MockBridge).getSocket() as MockXMLSocket; 201 Async.proceedOnEvent(this, socket, "send");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};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_HANDLEmailer.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) 203DatabaseMysql.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 }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);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."); 357StartOzServer.oz git://github.com/briancarper/dotfiles.git | Oz | 221 lines
99 100/** %% Creates a TCP socket server. Expects a Host (e.g., 'localhost') and a PortNo and returns a server plus its corresponding client. This client is an instance of Open.socket, and is the interface for reading and writing into the socket. 101%% MakeServer blocks until the server listens. However, waiting until a connection has been accepted happens in its own thread (i.e. MakeServer does only block until the server listens). 141declare 142%% Copied from OzServer/source/Socket.oz 143local 144 proc {Aux Socket Size Stream} 145 In = {Socket read(list:$ 146 size:Size)} 158in 159 /** %% The socket Server returns a stream of the strings it receives. The Server always waits until someone writes something into the socket, then the input is immediately written to a stream and the Server waits again. 160 %% */ 181%% 182%% Send socket input to compiler and send results back to socket 183%%ValidationPlugin.java git://github.com/playframework/play.git | Java | 201 lines
155 if (Http.Response.current() == null) { 156 // Some request like WebSocket don't have any response 157 return;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.client.py git://github.com/apenwarr/bup.git | Python | 347 lines
80 elif self.protocol == 'bup': 81 self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) 82 self.sock.connect((self.host, atoi(self.port) or 1982)) 109 self.sockw.close() 110 self.sock.shutdown(socket.SHUT_WR) 111 if self.conn: 290 self.file = conn 291 self.filename = 'remote socket' 292 self.suggest_packs = suggest_packsIConduit.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 & SocketConduit. 22InventoryPacket.java http://aionxemu.googlecode.com/svn/trunk/ | Java | 437 lines
245 writeFusionStones(buf, item); 246 writeC(buf, item.hasOptionalFusionSocket() ? item.getOptionalFusionSocket() : 0x00); 247 } 261 writeD(buf, item.getItemSkinTemplate().getTemplateId()); 262 writeC(buf, item.hasOptionalSocket() ? item.getOptionalSocket() : 0x00); 263 396 writeD(buf, item.getItemSkinTemplate().getTemplateId()); 397 writeC(buf, item.hasOptionalSocket() ? item.getOptionalSocket() : 0x00); 398meteobox.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);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-errorProgram.vb https://hg01.codeplex.com/sharpsnmplib | Visual Basic | 217 lines
13Imports System.Net 14Imports System.Net.Sockets 15 192 Console.WriteLine(ex) 193 Catch ex As SocketException 194 Console.WriteLine(ex)WebSocket.java git://github.com/Atmosphere/atmosphere.git | Java | 431 lines
49 protected static final Logger logger = LoggerFactory.getLogger(WebSocket.class); 50 public final static String WEBSOCKET_INITIATED = WebSocket.class.getName() + ".initiated"; 51 public final static String WEBSOCKET_SUSPEND = WebSocket.class.getName() + ".suspend"; 61 private final AtmosphereConfig config; 62 private WebSocketHandler webSocketHandler; 63 protected ByteBuffer bb; 91 92 protected WebSocket webSocketHandler(WebSocketHandler webSocketHandler) { 93 this.webSocketHandler = webSocketHandler; 107 108 public WebSocketHandler webSocketHandler() { 109 return webSocketHandler; 150 /** 151 * Return the an {@link AtmosphereResource} used by this WebSocket, or null if the WebSocket has been closed 152 * before the WebSocket message has been processed.BSPPeerImpl.java https://svn.apache.org/repos/asf/incubator/hama/ | Java | 0 lines
20import java.io.IOException; 21import java.net.InetSocketAddress; 22import java.util.Iterator; 79 80 private InetSocketAddress peerAddress; 81 private Counters counters; 130 .getInt(Constants.PEER_PORT, Constants.DEFAULT_PEER_PORT); 131 peerAddress = new InetSocketAddress(bindAddress, bindPort); 132 initialize(); 240 enterBarrier(); 241 Iterator<Entry<InetSocketAddress, LinkedList<BSPMessage>>> it = messenger 242 .getMessageIterator(); 244 while (it.hasNext()) { 245 Entry<InetSocketAddress, LinkedList<BSPMessage>> entry = it.next(); 246 final InetSocketAddress addr = entry.getKey();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 emptyStartupInfoGangliaSink.java https://svn.apache.org/repos/asf/incubator/flume/ | Java | 0 lines
100 101 private DatagramSocket datagramSocket; 102 final private String attr; // turns into the metric name. 176 try { 177 datagramSocket = new DatagramSocket(); 178 } catch (SocketException se) { 188 public void close() throws IOException, InterruptedException { 189 if (datagramSocket == null) { 190 LOG.warn("Double close"); 233 // send to each ganglia metrics listener/server 234 for (SocketAddress socketAddress : metricsServers) { 235 DatagramPacket packet = new DatagramPacket(buffer, offset, socketAddress); 250 251 for (SocketAddress socketAddress : metricsServers) { 252 DatagramPacket packet = new DatagramPacket(buffer, offset, socketAddress);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,server.h https://quake.svn.sourceforge.net/svnroot/quake | C Header | 286 lines
109 110 struct qsocket_s *netconnection; // communications handle 111 248void SV_ClientThink (void); 249void SV_AddClientToServer (struct qsocket_s *ret); 250MessagingWebSocket.java http://unitt.googlecode.com/svn/projects/ | Java | 281 lines
38 39 public MessagingWebSocket( String aServerId, MessageSerializerRegistry aSerializers, long aQueueTimeoutInMillis, ServerWebSocket aServerWebSocket ) 40 { 43 44 public MessagingWebSocket( String aServerId, MessageSerializerRegistry aSerializers, long aQueueTimeoutInMillis, ServerWebSocket aServerWebSocket, String aSocketId ) 45 { 120 121 public void setSocketId( String aSocketId ) 122 { 170 171 public void setServerWebSocket( ServerWebSocket aServerWebSocket ) 172 { 236 header.setSerializerType( serializerType ); 237 header.setWebSocketId( getSocketId() ); 238 header.setServerId( getServerId() );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)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 {RemoteX11AcceptThread.java https://code.google.com/p/sshtunnel/ | Java | 245 lines
5import java.io.OutputStream; 6import java.net.Socket; 7 25 26 Socket s; 27 172 173 s = new Socket(sd.hostname, sd.port); 174ProxyRequestHandler.java http://google-enterprise-connector-sharepoint.googlecode.com/svn/trunk/ | Java | 166 lines
97 try { 98 proxyconn.setSocketTimeout(0); 99 // Rewrite target urlfreeswitch.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) ->DistributedCoordinateSegmentation.hpp git://github.com/sirikata/sirikata.git | C++ Header | 301 lines
78 79 SocketContainer(SocketPtr socket) { 80 mSocket = socket; 189 void sendToAllCSEGServers( Sirikata::Protocol::CSeg::CSegMessage& ); 190 void sendOnAllSockets(Sirikata::Protocol::CSeg::CSegMessage csegMessage, std::map< ServerID, SocketContainer > socketList); 191 276 277 void requestServerRegionsOnSockets(boost::shared_ptr<tcp::socket> socket, ServerID server_id, 278 BoundingBoxList bbList, 285 286 void lookupBBoxOnSocket(boost::shared_ptr<tcp::socket> clientSocket, 287 const BoundingBox3f boundingBox, std::vector<ServerID> server_ids, 292 293 void sendLoadReportOnSocket(boost::shared_ptr<tcp::socket> clientSocket, BoundingBox3f boundingBox, Sirikata::Protocol::CSeg::LoadReportMessage message, std::map< ServerID, SocketContainer > socketList); 294server-cluster.py git://github.com/sirikata/sirikata.git | Python | 260 lines
13import server 14import socket 15import time 22 23hostname = socket.gethostname() 24AbstractProtocol.php git://github.com/zendframework/zf2.git | PHP | 0 lines
91 */ 92 protected $_socket; 93 259 // open connection 260 $this->_socket = @stream_socket_client($remote, $errorNum, $errorStr, self::TIMEOUT_CONNECTION); 261 261 262 if ($this->_socket === false) { 263 if ($errorNum == 0) { 268 269 if (($result = stream_set_timeout($this->_socket, self::TIMEOUT_CONNECTION)) === false) { 270 throw new Protocol\Exception\RuntimeException('Could not set stream timeout'); 284 if (is_resource($this->_socket)) { 285 fclose($this->_socket); 286 }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 }lhttpc_sock.erl https://bitbucket.org/etc/lhttpc/ | Erlang | 162 lines
53%% SslFlag = boolean() 54%% Socket = socket() 55%% Reason = atom() 86%% @spec (Socket, Length, SslFlag) -> {ok, Data} | {error, Reason} 87%% Socket = socket() 88%% Length = integer() 135%% @spec (Socket, Options, SslFlag) -> ok | {error, Reason} 136%% Socket = socket() 137%% Options = [atom() | {atom(), term()}] 142%% @end 143-spec setopts(socket(), socket_options(), boolean()) -> 144 ok | {error, atom()}. 150%% @spec (Socket, SslFlag) -> ok | {error, Reason} 151%% Socket = socket() 152%% SslFlag = boolean()SimpleMail.cs http://simple-assembly-explorer.googlecode.com/svn/trunk/ | C# | 315 lines
196 // { 197 // using (Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)) 198 // { 201 // int timeout = 10000; 202 // socket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReceiveTimeout, timeout); 203 // int port = 25; 203 // int port = 25; 204 // socket.Connect(_smtpServer, port); 205 // byte[] buffer = new byte[0x400]; 206 207 // int count = socket.Receive(buffer); 208 // string result = Encoding.ASCII.GetString(buffer, 0, count); 214 // socket.Send(bytes); 215 // count = socket.Receive(buffer); 216 // result = Encoding.ASCII.GetString(buffer, 0, count);PCCardAdapterPlugin.h git://github.com/openframeworks/openFrameworks.git | C Header | 205 lines
109CSReportStatusChange (const RegEntryID * adapterRef, 110 PCCardSocket whichSocket, 111 PCCardSCEvents statusChange, 125typedef CALLBACK_API_C( OSStatus , SSInquireSocketProc )(PCCardSocket socket, ItemCount *numberOfWindows, PCCardSocketStatus *supportedSocketStatus, PCCardSCEvents *supportedStatusChange); 126typedef CALLBACK_API_C( OSStatus , SSGetSocketProc )(PCCardSocket socket, PCCardVoltage *Vcc, PCCardVoltage *Vpp, PCCardVoltage *Vs, PCCardInterfaceType *socketIF, PCCardCustomInterfaceID *customIFID, PCCardSocketStatus *socketStatus, PCCardSCEvents *SCEventsMask, PCCardIRQ *IRQ, PCCardDMA *DMA); 127typedef CALLBACK_API_C( OSStatus , SSSetSocketProc )(PCCardSocket socket, PCCardVoltage Vcc, PCCardVoltage Vpp, PCCardInterfaceType socketIF, PCCardCustomInterfaceID customIFID, PCCardSocketStatus statusReset, PCCardSCEvents SCEventsMask, PCCardIRQ IRQ, PCCardDMA DMA); 128typedef CALLBACK_API_C( OSStatus , SSResetSocketProc )(PCCardSocket socket); 129typedef CALLBACK_API_C( OSStatus , SSGetStatusProc )(PCCardSocket socket, PCCardSocketStatus *currentStatus, PCCardSocketStatus *changedStatus); 130typedef CALLBACK_API_C( OSStatus , SSInquireWindowProc )(PCCardSocket *socket, PCCardWindow window, PCCardWindowState *windowState, PCCardWindowSize *windowSize, PCCardWindowAlign *windowAlign); 135typedef CALLBACK_API_C( OSStatus , SSInquireBridgeWindowProc )(PCCardSocket *socket, PCCardWindow window, PCCardWindowState *windowState, PCCardWindowSize *windowSize, PCCardWindowAlign *windowAlign); 136typedef CALLBACK_API_C( OSStatus , SSGetBridgeWindowProc )(PCCardSocket *socket, PCCardWindow window, PCCardWindowState *windowState, PhysicalAddress *startAddress, PCCardWindowSize *windowSize); 137typedef CALLBACK_API_C( OSStatus , SSSetBridgeWindowProc )(PCCardSocket socket, PCCardWindow window, PCCardWindowState windowState, PhysicalAddress startAddress, PCCardWindowSize windowSize); 168 SSSetSocketProc setSocket; 169 SSResetSocketProc resetSocket; 170 SSGetStatusProc getStatus;serve_socket.cpp http://qipmsg.googlecode.com/svn/trunk/ | C++ | 409 lines
49 50ServeSocket::ServeSocket(int socketDescriptor, QObject *parent) 51 : QObject(parent) 56 this, SLOT(updateBytesWrited(qint64))); 57 connect(&m_tcpSocket, SIGNAL(error(QAbstractSocket::SocketError)), 58 this, SLOT(socketError(QAbstractSocket::SocketError))); 60} 61ServeSocket::~ServeSocket() 62{ 94// 95// recvBlock.append(m_tcpSocket.read(m_tcpSocket.bytesAvailable())); 96// 124 125bool ServeSocket::handleRequest(const QByteArray &requestPacket) 126{bridge.c https://bitbucket.org/oojah/mosquitto/ | C | 174 lines
131 _mosquitto_log_printf(NULL, MOSQ_LOG_NOTICE, "Connecting bridge %s", context->bridge->name); 132 rc = _mosquitto_socket_connect(context, context->bridge->address, context->bridge->port); 133 if(rc != MOSQ_ERR_SUCCESS){net_loop.c https://quake.svn.sourceforge.net/svnroot/quake | C | 275 lines
44qboolean localconnectpending = false; 45qsocket_t *loop_client = NULL; 46qsocket_t *loop_server = NULL; 87 88qsocket_t * 89Loop_Connect (const char *host) 96 if (!loop_client) { 97 if ((loop_client = NET_NewQSocket ()) == NULL) { 98 Sys_Printf ("Loop_Connect: no qsocket available\n"); 107 if (!loop_server) { 108 if ((loop_server = NET_NewQSocket ()) == NULL) { 109 Sys_Printf ("Loop_Connect: no qsocket available\n"); 124 125qsocket_t * 126Loop_CheckNewConnections (void)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) {misultin_websocket_draft-hixie-68.erl git://github.com/ostinelli/misultin.git | Erlang | 131 lines
68-spec handshake(Req::#req{}, Headers::http_headers(), {Path::string(), Origin::string(), Host::string()}) -> iolist(). 69handshake(#req{socket_mode = SocketMode, ws_force_ssl = WsForceSsl} = _Req, _Headers, {Path, Origin, Host}) -> 70 % prepare handhsake response 86% ---------------------------------------------------------------------------------------------------------- 87-spec handle_data(Data::binary(), State::undefined | term(), {Socket::socket(), SocketMode::socketmode(), WsHandleLoopPid::pid()}) -> websocket_close | term(). 88handle_data(Data, undefined, {Socket, SocketMode, WsHandleLoopPid}) -> 111 Buffer::binary() | none, 112 {Socket::socket(), SocketMode::socketmode(), WsHandleLoopPid::pid()}) -> websocket_close | term(). 113i_handle_data(<<0, T/binary>>, none, {Socket, SocketMode, WsHandleLoopPid}) -> 117 {buffer, none}; 118i_handle_data(<<255, 0>>, _L, {Socket, SocketMode, _WsHandleLoopPid}) -> 119 ?LOG_DEBUG("websocket close message received from client, closing websocket with pid ~p", [self()]), 119 ?LOG_DEBUG("websocket close message received from client, closing websocket with pid ~p", [self()]), 120 misultin_socket:send(Socket, <<255, 0>>, SocketMode), 121 % return commandColumnFamilyRecordWriter.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);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"WsRpcServletWrapper.java http://gwt-websocketrpc.googlecode.com/svn/gwt-websocketrpc/ | Java | 271 lines
1package org.gwt_websocketrpc.server; 2 4import static com.google.gwt.user.client.rpc.RpcRequestBuilder.STRONG_NAME_HEADER; 5import static org.gwt_websocketrpc.shared.WsRpcConstants.WsRpcControlString; 6import static org.gwt_websocketrpc.server.ServerUtils.d; 17 18import org.eclipse.jetty.websocket.WebSocket; 19import org.gwt_websocketrpc.server.websocket.WsOutboundStream; 30@SuppressWarnings("serial") 31class WsRpcServletWrapper extends RpcServlet implements WebSocket { 32 139 140 // Instead we'll just grab it from the WebSocket message. 141 final String permStrongName = arg1.substring(0, snId); 217 // Set the TCCL... 218 // Possibly a bug in Jetty, WebSocketServlet's appear 219 // to have the incorrect TCCL set. The Java Appgetifaddrs.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);misultin_websocket_draft-hixie-76.erl git://github.com/ostinelli/misultin.git | Erlang | 160 lines
71-spec handshake(Req::#req{}, Headers::http_headers(), {Path::string(), Origin::string(), Host::string()}) -> iolist(). 72handshake(#req{socket = Sock, socket_mode = SocketMode, ws_force_ssl = WsForceSsl}, Headers, {Path, Origin, Host}) -> 73 % build data 115% ---------------------------------------------------------------------------------------------------------- 116-spec handle_data(Data::binary(), State::undefined | term(), {Socket::socket(), SocketMode::socketmode(), WsHandleLoopPid::pid()}) -> websocket_close | term(). 117handle_data(Data, undefined, {Socket, SocketMode, WsHandleLoopPid}) -> 140 Buffer::binary() | none, 141 {Socket::socket(), SocketMode::socketmode(), WsHandleLoopPid::pid()}) -> websocket_close | term(). 142i_handle_data(<<0, T/binary>>, none, {Socket, SocketMode, WsHandleLoopPid}) -> 143 i_handle_data(T, <<>>, {Socket, SocketMode, WsHandleLoopPid}); 144i_handle_data(<<>>, none, {_Socket, _SocketMode, _WsHandleLoopPid}) -> 145 % return status 148 ?LOG_DEBUG("websocket close message received from client, closing websocket with pid ~p", [self()]), 149 misultin_socket:send(Socket, <<255, 0>>, SocketMode), 150 % return commandpackage-tree.html http://xformsdb.googlecode.com/svn/trunk/ | HTML | 158 lines
93<LI TYPE="circle">class org.apache.tools.ant.taskdefs.optional.net.<A HREF="../../../../../../../org/apache/tools/ant/taskdefs/optional/net/RExecTask.RExecRead.html"><B>RExecTask.RExecRead</B></A><LI TYPE="circle">class org.apache.tools.ant.taskdefs.optional.net.<A HREF="../../../../../../../org/apache/tools/ant/taskdefs/optional/net/RExecTask.RExecWrite.html"><B>RExecTask.RExecWrite</B></A></UL> 94<LI TYPE="circle">class org.apache.commons.net.SocketClient<UL> 95<LI TYPE="circle">class org.apache.commons.net.bsd.RExecClient<UL>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 }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#endifTestLogRollAbort.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);manager.cc git://github.com/yahoo/Pluton.git | C++ | 420 lines
81 _reapChildrenFlag(false), 82 _quitMessage(0), _commandAcceptSocket(-1), 83 _serviceCount(0), 168////////////////////////////////////////////////////////////////////////// 169// Initialize the listening socket for the command port. Return false 170// on any failure with an error message. 183 184 _commandAcceptSocket = li.transferFD(); // Take ownership of the FD 185 185 186 if (util::setCloseOnExec(_commandAcceptSocket) == -1) { 187 util::messageWithErrno(em, "Could not set FD_CLOEXEC on Command Accept Socket", 188 _commandPortInterface); 189 close(_commandAcceptSocket); 190 _commandAcceptSocket = -1;Makefile.in http://qse.googlecode.com/svn/trunk/qse/ | Autoconf | 429 lines
161SHELL = @SHELL@ 162SOCKET_LIBS = @SOCKET_LIBS@ 163SSL_LIBS = @SSL_LIBS@ConnectionListener.cs http://sharpmud-framework.googlecode.com/svn/trunk/ | C# | 199 lines
2using System.Net; 3using System.Net.Sockets; 4 10 private System.Collections.ArrayList _WaitingConnections; 11 private System.Net.Sockets.TcpListener _TcpListener; 12 private int _Port; 58 _WaitingConnections = new System.Collections.ArrayList(); 59 _TcpListener = new System.Net.Sockets.TcpListener(_Address, _Port); 60 _Host = host; 80 /// <summary> 81 /// The list of connections that have had their sockets accepted and are awaiting to be handled 82 /// </summary> 155 { 156 NetworkConnection cw = new NetworkConnection(_TcpListener.AcceptSocket()); 157SOCK_SEQPACK_Association.h https://bitbucket.org/oregon/oregoncore/ | C Header | 200 lines
46 * then the call behaves as a normal send/recv call, i.e., for 47 * blocking sockets, the call will block until action is possible; 48 * for non-blocking sockets, EWOULDBLOCK will be returned if no 52 * The "_n()" I/O methods keep looping until all the data has been 53 * transferred. These methods also work for sockets in non-blocking 54 * mode i.e., they keep looping on EWOULDBLOCK. @a timeout is used 107 108 /// Try to recv exactly @a len bytes into @a buf from the connected socket. 109 ssize_t recv_n (void *buf, 114 115 /// Try to recv exactly @a len bytes into @a buf from the connected socket. 116 ssize_t recv_n (void *buf, 120 121 /// Receive an <iovec> of size <iovcnt> from the connected socket. 122 ssize_t recvv_n (iovec iov[],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 137hdldsvr.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)config.h git://github.com/rhomobile/rhodes.git | C Header | 611 lines
100#define HAVE_SYS_SELECT_H 1 101#define HAVE_SYS_SOCKET_H 1 102#define HAVE_SYS_SYSCALL_H 1internets.pas git://github.com/moparisthebest/Simba.git | Pascal | 447 lines
67 procedure Info(out IP, Port: string); 68 constructor Create(Owner: TObject; Socket: TTCPBlockSocket = nil); 69 destructor Destroy; override; 78 function CreateSocket: integer; 79 function CreateSocketEx(Socket: TTCPBlockSocket): integer; 80 function GetSocket(Index: integer): TSock; 306 307function TSocks.CreateSocketEx(Socket: TTCPBlockSocket): integer; 308begin; 417 Socket := TTCPBlockSocket.Create; 418 Socket.Socket := Sock.Accept; 419 Result := Socket; 429 430constructor TSock.Create(Owner: TObject; Socket: TTCPBlockSocket = nil); 431beginLoggingEvent.java https://svn.apache.org/repos/asf/incubator/isis/ | Java | 0 lines
106 * to do it again. Note that its value is always false when 107 * serialized. Thus, a receiving SocketNode will never use it's own 108 * (incorrect) NDC. See also writeObject method. */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.drvconn.cc http://versaplex.googlecode.com/svn/trunk/ | C++ | 522 lines
15#include <sys/types.h> 16#include <sys/socket.h> 17#define NEARNetworkTunerServer.java http://customsagetv.googlecode.com/svn/trunk/ | Java | 226 lines
38 39 private ServerSocket serversocket = null; 40 private DatagramSocket datagramSocket = null; 112 try { 113 serversocket = new ServerSocket(config.getPort()); 114 } catch (Exception exception) { 114 } catch (Exception exception) { 115 logger.error("Error creating network tuner socket: " + config.getPort(), exception); 116 return; 123 try { 124 Socket socket = serversocket.accept(); 125 socket.setSoTimeout(15000); 162 try { 163 datagramSocket = new DatagramSocket(8271); 164 } catch (IOException ioexception) {client.go git://github.com/border/golang-china.git | Go | 316 lines
28 ErrBadUpgrade = &ProtocolError{"missing or bad upgrade"} 29 ErrBadWebSocketOrigin = &ProtocolError{"missing or bad WebSocket-Origin"} 30 ErrBadWebSocketLocation = &ProtocolError{"missing or bad WebSocket-Location"} 30 ErrBadWebSocketLocation = &ProtocolError{"missing or bad WebSocket-Location"} 31 ErrBadWebSocketProtocol = &ProtocolError{"missing or bad WebSocket-Protocol"} 32 ErrChallengeResponse = &ProtocolError{"mismatch challange/response"} 69 import ( 70 "websocket" 71 "strings" 210 fields.Push("Sec-WebSocket-Key1: " + key1 + "\r\n") 211 fields.Push("Sec-WebSocket-Key2: " + key2 + "\r\n") 212 241 242 // Step 41. check websocket headers. 243 if resp.Header["Upgrade"] != "WebSocket" ||WorldSocketMgr.cpp https://bitbucket.org/oregon/oregoncore/ | C++ | 361 lines
104 105 int AddSocket (WorldSocket* sock) 106 { 130 131 for (SocketSet::iterator i = m_NewSockets.begin(); i != m_NewSockets.end(); ++i) 132 { 167 168 for (i = m_Sockets.begin(); i != m_Sockets.end();) 169 { 198 199 SocketSet m_Sockets; 200 310int 311WorldSocketMgr::OnSocketOpen (WorldSocket* sock) 312{SocketImpl.h git://github.com/openframeworks/openFrameworks.git | C++ Header | 470 lines
49 50 virtual SocketImpl* acceptConnection(SocketAddress& clientAddr); 51 /// Get the next completed connection from the 370 SocketImpl(poco_socket_t sockfd); 371 /// Creates a SocketImpl using the given native socket. 372 401 void reset(poco_socket_t fd = POCO_INVALID_SOCKET); 402 /// Allows subclasses to set the socket manually, iff no valid socket is set yet. 403 420 SocketImpl(const SocketImpl&); 421 SocketImpl& operator = (const SocketImpl&); 422 437// 438inline poco_socket_t SocketImpl::sockfd() const 439{misultin_socket.erl git://github.com/ostinelli/misultin.git | Erlang | 129 lines
45% socket listen 46-spec listen(Port::non_neg_integer(), Options::gen_proplist(), socketmode()) -> {ok, ListenSock::socket()} | {error, Reason::term()}. 47listen(Port, Options, http) -> gen_tcp:listen(Port, Options); 50% socket accept 51-spec accept(ListenSocket::socket(), socketmode()) -> {ok, ListenSock::socket()} | {error, Reason::term()}. 52accept(ListenSocket, http) -> gen_tcp:accept(ListenSocket); 65% Get socket peername 66-spec peername(Sock::socket(), socketmode() | function()) -> {inet:ip_address(), non_neg_integer()}. 67peername(Sock, http) -> peername(Sock, fun inet:peername/1); 96% socket send 97-spec send(Sock::socket(), Data::binary() | iolist() | list(), socketmode() | function()) -> ok. 98send(Sock, Data, http) -> send(Sock, Data, fun gen_tcp:send/2); 110% TCP close 111-spec close(Sock::socket(), socketmode() | function()) -> ok. 112close(Sock, http) -> close(Sock, fun gen_tcp:close/1);HttpServer.java http://npr-android-app.googlecode.com/svn/trunk/ | Java | 325 lines
28import java.net.InetAddress; 29import java.net.ServerSocket; 30import java.net.Socket; 31import java.net.SocketException; 32import java.net.SocketTimeoutException; 33import java.net.URLDecoder; 47 private boolean isRunning = true; 48 private ServerSocket socket; 49 private Thread thread; 70 try { 71 socket = new ServerSocket(port, 0, InetAddress.getByAddress(new byte[] { 72 127, 0, 0, 1 })); 152 try { 153 Socket client = socket.accept(); 154 if (client == null) {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_HSocket.html http://xformsdb.googlecode.com/svn/trunk/ | HTML | 300 lines
8</TITLE> 9<META NAME="keywords" CONTENT="org.apache.tools.ant.taskdefs.optional.sitraka.Socket,Socket class"> 10<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../../../stylesheet.css" TITLE="Style"> 14{ 15parent.document.title="Socket (Apache Ant API)"; 16} 77<BR> 78Class Socket</H2> 79<PRE> 93 <tt> 94 <socket host="e;175.30.12.1"e; port="e;4567"e;/> 95 </tt> 116<TR BGCOLOR="white" CLASS="TableRowColor"> 117<TD><CODE><B><A HREF="../../../../../../../org/apache/tools/ant/taskdefs/optional/sitraka/Socket.html#Socket()">Socket</A></B>()</CODE> 118unix_socket_constants.h git://github.com/php/php-src.git | C Header | 422 lines
16 17/* This file is to be included by sockets.c */ 18 20 /* Operation not permitted */ 21 REGISTER_LONG_CONSTANT("SOCKET_EPERM", EPERM, CONST_CS | CONST_PERSISTENT); 22#endif 24 /* No such file or directory */ 25 REGISTER_LONG_CONSTANT("SOCKET_ENOENT", ENOENT, CONST_CS | CONST_PERSISTENT); 26#endif 28 /* Interrupted system call */ 29 REGISTER_LONG_CONSTANT("SOCKET_EINTR", EINTR, CONST_CS | CONST_PERSISTENT); 30#endif 291#ifdef ENOTSOCK 292 /* Socket operation on non-socket */ 293 REGISTER_LONG_CONSTANT("SOCKET_ENOTSOCK", ENOTSOCK, CONST_CS | CONST_PERSISTENT);package-tree.html http://xformsdb.googlecode.com/svn/trunk/ | HTML | 161 lines
99<LI TYPE="circle">class org.apache.tools.ant.taskdefs.condition.<A HREF="../../../../../../org/apache/tools/ant/taskdefs/condition/IsTrue.html"><B>IsTrue</B></A> (implements org.apache.tools.ant.taskdefs.condition.<A HREF="../../../../../../org/apache/tools/ant/taskdefs/condition/Condition.html">Condition</A>) 100<LI TYPE="circle">class org.apache.tools.ant.taskdefs.condition.<A HREF="../../../../../../org/apache/tools/ant/taskdefs/condition/Socket.html"><B>Socket</B></A> (implements org.apache.tools.ant.taskdefs.condition.<A HREF="../../../../../../org/apache/tools/ant/taskdefs/condition/Condition.html">Condition</A>) 101</UL>SocketImpl.hpp git://github.com/LaurentGomila/SFML.git | C++ Header | 112 lines
52//////////////////////////////////////////////////////////// 53class SocketImpl 54{ 78 //////////////////////////////////////////////////////////// 79 static SocketHandle invalidSocket(); 80 81 //////////////////////////////////////////////////////////// 82 /// \brief Close and destroy a socket 83 /// 83 /// 84 /// \param sock Handle of the socket to close 85 /// 111 112#endif // SFML_SOCKETIMPL_HPP 113encoding.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 publicsmtplib.py https://mailman.svn.sourceforge.net/svnroot/mailman | Python | 170 lines
33 34from socket import * 35import string, types 57 def connect(self): 58 self._sock = socket(AF_INET, SOCK_STREAM) 59 self._sock.connect(self.host, SMTP_PORT)config-openvms.h git://github.com/TrinityCore/TrinityCore.git | C Header | 193 lines
129#define ACE_HAS_XPG4_MULTIBYTE_CHAR 1 130#define ACE_HAS_SIZET_SOCKET_LEN 1 131#define ACE_HAS_SSIZE_T 1 179#define ACE_LACKS_SYSV_SHMEM 1 180#define ACE_LACKS_UNIX_DOMAIN_SOCKETS 1 181#define ACE_LACKS_UNIX_SYSLOG 1Master.cpp https://code.google.com/p/oregoncore/ | C++ | 463 lines
24 25#include "WorldSocketMgr.h" 26#include "Common.h" 27#include "Master.h" 28#include "WorldSocket.h" 29#include "WorldRunnable.h" 218 219 uint32 socketSelecttime = sWorld.getConfig(CONFIG_SOCKET_SELECTTIME); 220 230 231 // Launch the world listener socket 232 uint16 wsport = sWorld.getConfig(CONFIG_PORT_WORLD); 234 235 if (sWorldSocketMgr->StartNetwork (wsport, bind_ip.c_str ()) == -1) 236 {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 292SocketConnection.hx git://github.com/outbounder/org.abn.haxe.git | Haxe | 408 lines
50 public var port(default,null) : Int; 51 public var socket(default,null) : Socket; 52 public var secure(default,null) : Bool; //TODO move to jabber.socket.Connection 80 81 socket = new Socket(); 82 90 #elseif (neko||cpp) 91 socket = new Socket(); 92 buf = haxe.io.Bytes.alloc( defaultBufSize ); 147 #if flash9 148 socket.addEventListener( ProgressEvent.SOCKET_DATA, sockDataHandler ); 149 #elseif (neko||php||cpp) 159 #if flash9 160 socket.removeEventListener( ProgressEvent.SOCKET_DATA, sockDataHandler ); 161 #elseif (neko||php||cpp)run.py https://bitbucket.org/mirror/python-trunk/ | Python | 343 lines
3import time 4import socket 5import traceback 41# Thread shared globals: Establish a queue between a subthread (which handles 42# the socket) and the main thread (which runs user code), plus global 43# completion, exit and interruptable (the main thread) flags: 53 MyHandler, which inherits register/unregister methods from RPCHandler via 54 the mix-in class SocketIO. 55 62 (e.g. RemoteDebugger.Debugger.start_debugger()). The latter, in turn, can 63 call MyHandler(SocketIO) register/unregister methods via the reference to 64 register and unregister themselves. 78 sys.argv[:] = [""] 79 sockthread = threading.Thread(target=manage_socket, 80 name='SockThread',AuthServerClient.cs https://bitbucket.org/VoiDeD/steamre/ | C# | 0 lines
131 { 132 internalIp = NetHelpers.GetIPAddress( Socket.GetLocalIP() ); 133 143 144 Socket.Send( bb.ToArray() ); 145 145 146 byte result = Socket.Reader.ReadByte(); 147 151 152 Socket.Disconnect(); 153 return false; 155 156 externalIp = NetHelpers.EndianSwap( Socket.Reader.ReadUInt32() ); 157 }Ping_Socket.cpp https://code.google.com/p/oregoncore/ | C++ | 371 lines
93 94ACE_Ping_Socket::ACE_Ping_Socket (void) 95{ 104{ 105 ACE_TRACE ("ACE_Ping_Socket::ACE_Ping_Socket"); 106 112 ACE_DEBUG ((LM_DEBUG, 113 ACE_TEXT ("ACE_Ping_Socket::ACE_Ping_Socket: %p\n"), 114 ACE_TEXT ("open"))); 127 128ACE_Ping_Socket::~ACE_Ping_Socket (void) 129{ 129{ 130 ACE_TRACE ("ACE_Ping_Socket::~ACE_Ping_Socket"); 131}if_loop.c https://bitbucket.org/freebsd/freebsd-head/ | C | 488 lines
48#include <sys/rman.h> 49#include <sys/socket.h> 50#include <sys/sockio.h>luaNSLComm.cc git://github.com/UPenn-RoboCup/UPennalizers.git | C++ | 0 lines
7#include <sys/types.h> 8#include <sys/socket.h> 9#include <netinet/in.h> 69 70 send_fd = socket(AF_INET, SOCK_DGRAM, 0); 71 if (send_fd < 0) { 71 if (send_fd < 0) { 72 printf("Could not open datagram send socket\n"); 73 return -1; 76 int i = 1; 77 if (setsockopt(send_fd, SOL_SOCKET, SO_BROADCAST, (const char *) &i, sizeof(i)) < 0) { 78 printf("Could not set broadcast option\n"); 92 93 recv_fd = socket(AF_INET, SOCK_DGRAM, 0); 94 if (recv_fd < 0) {Reading.pm git://github.com/rcaputo/reflex.git | Perl | 233 lines
144C<cb_closed> names the $self method that will be called whenever 145C<handle> has reached the end of readable data. For sockets, this 146means the remote endpoint has closed or shutdown for writing.interactiveshell.py git://github.com/ipython/ipython.git | Python | 343 lines
142 Arguments: 143 sub_msg: message receive from kernel in the sub socket channel 144 capture by kernel manager.config.lua http://ibus-sogoupycc.googlecode.com/svn/trunk/ | Lua | 84 lines
4-- ?? luasocket ?? 5http, url = require('socket.http'), require('socket.url') 6configure.ac http://jslibs.googlecode.com/svn/trunk/ | m4 | 320 lines
115AC_CHECK_HEADERS(sys/syscall.h) 116AC_CHECK_HEADERS(sys/socket.h) # optional; for forking out to symbolizer 117AC_CHECK_HEADERS(sys/wait.h) # optional; for forking out to symbolizerNetworkUtils.java git://github.com/CyanogenMod/android_frameworks_base.git | Java | 376 lines
42 /** 43 * Attaches a socket filter that accepts DHCP packets to the given socket. 44 */ 47 /** 48 * Attaches a socket filter that accepts ICMPv6 router advertisements to the given socket. 49 * @param fd the socket's {@link FileDescriptor}. 51 */ 52 public native static void attachRaFilter(FileDescriptor fd, int packetType) throws SocketException; 53 58 */ 59 public native static void setupRaSocket(FileDescriptor fd, int ifIndex) throws SocketException; 60 90 */ 91 public native static int bindSocketToNetwork(int socketfd, int netId); 92TestJmxMonitoredMap.java git://github.com/apache/lucene-solr.git | Java | 218 lines
36import java.lang.invoke.MethodHandles; 37import java.net.ServerSocket; 38import java.rmi.registry.LocateRegistry; 38import java.rmi.registry.LocateRegistry; 39import java.rmi.server.RMIServerSocketFactory; 40import java.util.Set; 73 System.setProperty("java.rmi.server.hostname", "127.0.0.1"); 74 class LocalhostRMIServerSocketFactory implements RMIServerSocketFactory { 75 ServerSocket socket; 77 @Override 78 public ServerSocket createServerSocket(int port) throws IOException { 79 return socket = new ServerSocket(port); 81 }; 82 LocalhostRMIServerSocketFactory factory = new LocalhostRMIServerSocketFactory(); 83 LocateRegistry.createRegistry(0, null, factory);FtpConnection.java https://jedit.svn.sourceforge.net/svnroot/jedit | Java | 560 lines
141 142 setupSocket(); 143 218 { 219 setupSocket(); 220 InputStream in = client.retrieveStream(path); 228 { 229 setupSocket(); 230 OutputStream out = client.storeStream(path); 332 333 private void setupSocket() 334 throws IOException 362 363 setupSocket(); 364 Reader _in = (tryHiddenFiles ? client.list("-a") : client.list());versaplexd.cs http://versaplex.googlecode.com/svn/trunk/ | C# | 278 lines
239 socket.Blocking = true; 240 SocketHandle = (long)socket.Handle; 241 Stream = new NetworkStream(socket); 246 AbstractUnixEndPoint ep = new AbstractUnixEndPoint(path); 247 VxNotifySocket client = new VxNotifySocket(AddressFamily.Unix, 248 SocketType.Stream, 0); 255 UnixEndPoint ep = new UnixEndPoint(path); 256 VxNotifySocket client = new VxNotifySocket(AddressFamily.Unix, 257 SocketType.Stream, 0); 266 IPEndPoint ep = new IPEndPoint(ip, port); 267 VxNotifySocket client = new VxNotifySocket(AddressFamily.InterNetwork, 268 SocketType.Stream, 0); 273 protected VxNotifySocket socket; 274 public VxNotifySocket Socket { 275 get { return socket; }Collectd.pm git://github.com/octo/collectd.git | Perl | 218 lines
20 21=item collectd_socket [ socket path ] (default: /var/run/collectd-email) 22 22 23Where the collectd socket is 24 53collect statistical informations in rrd files to create some nice looking 54graphs with rrdtool. They communicate over a unix socket that the collectd 55plugin creates. The generated graphs will be placed in /var/lib/collectd/email 85use Time::HiRes qw(usleep); 86use IO::Socket; 87 154 for (my $i = 0; $i < $self->{main}->{conf}->{collectd_retries} ; ++$i) { 155 my ($socket_path) = $self->{main}->{conf}->{collectd_socket} =~ /(.*)/; # Untaint path, which can contain any characters. 156 last if $sock = new IO::Socket::UNIX $socket_path;_opener.py git://github.com/playframework/play.git | Python | 436 lines
27import _rfc3986 28import _sockettimeout 29import _upgrade 152 def _request(self, url_or_req, data, visit, 153 timeout=_sockettimeout._GLOBAL_DEFAULT_TIMEOUT): 154 if isstringlike(url_or_req): 163 set_request_attr(req, "timeout", timeout, 164 _sockettimeout._GLOBAL_DEFAULT_TIMEOUT) 165 return req 167 def open(self, fullurl, data=None, 168 timeout=_sockettimeout._GLOBAL_DEFAULT_TIMEOUT): 169 req = self._request(fullurl, data, None, timeout) 228 def retrieve(self, fullurl, filename=None, reporthook=None, data=None, 229 timeout=_sockettimeout._GLOBAL_DEFAULT_TIMEOUT): 230 """Returns (filename, headers).SocketMonitor.as http://dn-translation.googlecode.com/svn/trunk/ | ActionScript | 202 lines
79 80 /* Variable_socket can be null if createSocket is overridden in derived classes. 81 * For example, subclass SecureSocketMonitor returns null when the SecureSocket API is not supported. 118 119 _socket.addEventListener(Event.CONNECT, cool); 120 _socket.addEventListener(IOErrorEvent.IO_ERROR, uncool); 189 * 190 * @return the Socket object to be used by this SocketMonitor. 191 * 193 */ 194 protected function createSocket():Socket 195 { 198 199 private var _socket:Socket = createSocket(); 200}SOCK_Acceptor.cpp https://bitbucket.org/oregon/oregoncore/ | C++ | 418 lines
5#include "ace/OS_NS_string.h" 6#include "ace/OS_NS_sys_socket.h" 7#include "ace/os_include/os_fcntl.h" 91 // Reset the event association inherited by the new handle. 92 ::WSAEventSelect ((SOCKET) new_handle, 0, 0); 93#else 197 // Reset the size of the addr, which is only necessary for UNIX 198 // domain sockets. 199 if (new_stream.get_handle () != ACE_INVALID_HANDLE 243# if defined (ACE_WIN32) 244 // on windows vista and later, Winsock can support dual stack sockets 245 // but this must be explicitly set prior to the bind. Since thisloaders.php git://github.com/speedmax/h2o-php.git | PHP | 290 lines
251 /** 252 * @var host default is file socket 253 */pop3send.pas git://github.com/rofl0r/KOL.git | Pascal | 265 lines
44 private 45 FSock: PTCPBlockSocket; 46 FTimeout: Integer; 85 property AuthType: TPOP3AuthType read FAuthType Write FAuthType; 86 property Sock: PTCPBlockSocket read FSock; 87 end; 101 Result.FFullResult := NewStrList; 102 Result.FSock := NewTCPBlockSocket; 103 Result.FSock.CreateSocket; 164 FStatSize := 0; 165 FSock.CloseSocket; 166 FSock.LineBuffer := ''; 166 FSock.LineBuffer := ''; 167 FSock.CreateSocket; 168 FSock.Connect(POP3Host, POP3Port);ISocketHandler.h https://bitbucket.org/oregon/oregoncore/ | C Header | 0 lines
67#ifdef ENABLE_POOL 68 class PoolSocket : public Socket 69 { 70 public: 71 PoolSocket(ISocketHandler& h,Socket *src) : Socket(h) { 72 CopyConnection( src ); 103private: 104 /** Remove socket from socket map, used by Socket class. */ 105 virtual void Remove(Socket *) = 0; 135 /** Find available open connection (used by connection pool). */ 136 virtual ISocketHandler::PoolSocket *FindConnection(int type,const std::string& protocol,SocketAddress&) = 0; 137 /** Enable connection pool (by default disabled). */ 230 231#endif // _SOCKETS_ISocketHandler_H 232WebSocket00.h http://unitt.googlecode.com/svn/projects/ | C Header | 181 lines
31 WebSocketReadyStateConnecting = 0, //The connection has not yet been established. 32 WebSocketReadyStateOpen = 1, //The WebSocket connection is established and communication is possible. 33 WebSocketReadyStateClosing = 2, //The connection is going through the closing handshake. 70 NSString* origin; 71 AsyncSocket* socket; 72 WebSocketReadyState readystate; 87/** 88 * Callback delegate for websocket events. 89 **/ 111 * - WebSocketReadyStateConnecting: The connection has not yet been established. 112 * - WebSocketReadyStateOpen: The WebSocket connection is established and communication is possible. 113 * - WebSocketReadyStateClosing: The connection is going through the closing handshake. 156 157+ (id) webSocketWithURLString:(NSString*) aUrlString delegate:(id<WebSocketDelegate>) aDelegate origin:(NSString*) aOrigin protocols:(NSArray*) aProtocols tlsSettings:(NSDictionary*) aTlsSettings verifyHandshake:(BOOL) aVerifyHandshake; 158- (id) initWithURLString:(NSString *) aUrlString delegate:(id<WebSocketDelegate>) aDelegate origin:(NSString*) aOrigin protocols:(NSArray*) aProtocols tlsSettings:(NSDictionary*) aTlsSettings verifyHandshake:(BOOL) aVerifyHandshake;FrostbiteLayerConnection.cs https://hg01.codeplex.com/procon | C# | 205 lines
4using System.Net; 5using System.Net.Sockets; 6 77 } 78 catch (SocketException) { 79 this.Shutdown(); 92 } 93 catch (SocketException) { 94 // TO DO: Error reporting, possibly in a log file. 194 } 195 catch (SocketException) { 196 // TO DO: Error reporting, possibly in a log file.relay.c https://dnrd.svn.sourceforge.net/svnroot/dnrd | C | 275 lines
24#include <sys/types.h> 25#include <sys/socket.h> 26#include <netinet/in.h>test_httpresponse.rb git://github.com/ruby/ruby.git | Ruby | 467 lines
454 res = Net::HTTPUnknownResponse.new('1.0', '???', 'test response') 455 socket = Net::BufferedIO.new(StringIO.new('test body')) 456 res.reading_body(socket, true) {}RubyTCPSocket.java git://github.com/jruby/jruby.git | Java | 187 lines
64 static void createTCPSocket(Ruby runtime) { 65 RubyClass rb_cTCPSocket = runtime.defineClass("TCPSocket", runtime.getClass("IPSocket"), TCPSOCKET_ALLOCATOR); 66 70 71 runtime.getObject().setConstant("TCPsocket",rb_cTCPSocket); 72 } 104 final SocketChannel channel = SocketChannel.open(); 105 final Socket socket = channel.socket(); 106 if (localHost != null) { 106 if (localHost != null) { 107 socket.bind( new InetSocketAddress(InetAddress.getByName(localHost), localPort) ); 108 } 145 public static IRubyObject open(ThreadContext context, IRubyObject recv, IRubyObject[] args, Block block) { 146 RubyTCPSocket sock = (RubyTCPSocket)recv.callMethod(context,"new",args); 147 if (!block.isGiven()) return sock;Cluster.cs http://cassandra-sharp.googlecode.com/svn/ | C# | 223 lines
4 using System.IO; 5 using System.Net.Sockets; 6 using Apache.Cassandra; 118 } 119 else if (ex is SocketException) 120 {stream.cpp http://es-operating-system.googlecode.com/svn/trunk/ | C++ | 496 lines
189 { 190 SocketUninstaller uninstaller(this->socket); 191 adapter->accept(&uninstaller); 283 { 284 monitor->wait(socket->getTimeout()); 285 328bool StreamReceiver:: 329accept(SocketMessenger* m, Conduit* c) 330{ 356 357 if (socket->getTimeout() == 0 && !socket->getBlocking()) 358 { 491 ASSERT(accepted->socket); 492 m->setSocket(accepted->socket); 493 }args.c https://dnrd.svn.sourceforge.net/svnroot/dnrd | C | 352 lines
27#endif 28#include <sys/socket.h> 29#include <netinet/in.h> 112#endif 113" -M, --max-sock=N Set maximum number of open sockets to N\n" 114" -r, --retry=N Set retry interval to N seconds\n" 145#endif 146" -M N Set maximum number of open sockets to N\n" 147" -r N Set retry interval to N seconds\n" 250 case 'M': { 251 max_sockets = atoi(optarg); 252 log_debug(1, "Setting maximum number of open sockets to %i", 252 log_debug(1, "Setting maximum number of open sockets to %i", 253 max_sockets); 254 break;SocksHandler.cs http://msnp-sharp.googlecode.com/svn/trunk/ | C# | 242 lines
107 try { 108 m_RemoteConnection.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.KeepAlive, 1); 109 } catch {} 113 ///<value>A Socket that is used to accept incoming connections.</value> 114 protected Socket AcceptSocket { 115 get { 118 set { 119 m_AcceptSocket = value; 120 } 203 else 204 AcceptSocket.BeginAccept(new AsyncCallback(this.OnAccept), AcceptSocket); 205 } catch { 233 /// <summary>Holds the value of the AcceptSocket property.</summary> 234 private Socket m_AcceptSocket; 235 /// <summary>Holds the value of the RemoteBindIP property.</summary>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(ContentLengthInputStream.java http://google-enterprise-connector-sharepoint.googlecode.com/svn/trunk/ | Java | 221 lines
110 * 111 * <p>Does not close the underlying socket input, but instead leaves it 112 * primed to parse the next response.</p>socket.h http://streetview-explorer.googlecode.com/svn/trunk/ | C++ Header | 379 lines
15 - wxSocketBase is the public class representing a socket ("Base" here 16 refers to the fact that wxSocketClient and wxSocketServer are derived 17 from it and predates the convention of using "Base" for common base 142 // create the socket implementation object matching this manager 143 virtual wxSocketImpl *CreateSocket(wxSocketBase& wxsocket) = 0; 144 264 // value is composed of a (possibly empty) subset of the bits set in flags 265 wxSocketEventFlags Select(wxSocketEventFlags flags, 266 const timeval *timeout = NULL); 277 // no pending connections as our sockets are non-blocking) 278 wxSocketImpl *Accept(wxSocketBase& wxsocket); 279 313protected: 314 wxSocketImpl(wxSocketBase& wxsocket); 315TestGangliaSink.java https://svn.apache.org/repos/asf/incubator/flume/ | Java | 0 lines
43import java.net.DatagramPacket; 44import java.net.DatagramSocket; 45import java.util.concurrent.CountDownLatch; 157 */ 158 class GangliaSocketListener implements Runnable { 159 168 public void run() { 169 DatagramSocket s; 170 try { 170 try { 171 s = new DatagramSocket(); 172 setPort(s.getLocalPort()); 244 String hostName = NetUtils.localhost(); 245 GangliaSocketListener listener = new GangliaSocketListener(); 246 Thread listenerThread = new Thread(listener);views.py git://github.com/flashingpumpkin/django-socialregistration.git | Python | 348 lines
11import logging 12import socket 13 215 return self.error_to_response(request, {'error': error}) 216 except socket.timeout: 217 return self.error_to_response(request, {'error': 262 return self.error_to_response(request, {'error': error}) 263 except socket.timeout: 264 return self.error_to_response(request, {'error':AuthUserPass.cs http://msnp-sharp.googlecode.com/svn/trunk/ | C# | 144 lines
33using System.Net; 34using System.Net.Sockets; 35using Org.Mentalis.Proxy; 51 ///<param name="Callback">The method to call when the authentication is complete.</param> 52 internal override void StartAuthentication(Socket Connection, AuthenticationCompleteDelegate Callback) { 53 this.Connection = Connection; 56 Bytes = null; 57 Connection.BeginReceive(Buffer, 0, Buffer.Length, SocketFlags.None, new AsyncCallback(this.OnRecvRequest), Connection); 58 } catch { 74 else 75 Connection.BeginReceive(Buffer, 0, Buffer.Length, SocketFlags.None, new AsyncCallback(this.OnRecvRequest), Connection); 76 } catch { 98 ToSend = new byte[]{5, 0}; 99 Connection.BeginSend(ToSend, 0, ToSend.Length, SocketFlags.None, new AsyncCallback(this.OnOkSent), Connection); 100 } else {README.md git://github.com/joyent/node.git | Markdown | 179 lines
44 http_parser_init(parser, HTTP_REQUEST); 45 parser->data = my_socket; 46 46 47When data is received on the socket execute the parser and check for errors. 48 91HTTP supports upgrading the connection to a different protocol. An 92increasingly common example of this is the Web Socket protocol which sends 93a request like 95 GET /demo HTTP/1.1 96 Upgrade: WebSocket 97 Connection: Upgrade 99 Origin: http://example.com 100 WebSocket-Protocol: sample 101