Search Results

Search found 3087 results on 124 pages for 'socket 940'.

Page 5/124 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Wake up thread blocked on accept() call

    - by selbie
    Sockets on Linux question I have a worker thread that is blocked on an accept() call. It simply waits for an incoming network connection, handles it, and then returns to listening for the next connection. When it is time for the program to exit, how do I signal this network worker thread (from the main thread) to return from the accept() call while still being able to gracefully exit its loop and handle it's cleanup code. Some things I tried: 1. pthread_kill to send a signal. Feels kludgy to do this, plus it doesn't reliably allow the thread to do it's shutdown logic. Also makes the program terminate as well. I'd like to avoid signals if at all possible. pthread_cancel. Same as above. It's a harsh kill on the thread. That, and the thread may be doing something else. Closing the listen socket from the main thread in order to make accept() abort. This doesn't reliably work. Some constraints: If the solution involves making the listen socket non-blocking, that is fine. But I don't want to accept a solution that involves the thread waking up via a select call every few seconds to check the exit condition. The thread condition to exit may not be tied to the process exiting. Essentially, the logic I am going for looks like this. void* WorkerThread(void* args) { DoSomeImportantInitialization(); // initialize listen socket and some thread specific stuff while (HasExitConditionBeenSet()==false) { listensize = sizeof(listenaddr); int sock = accept(listensocket, &listenaddr, &listensize); // check if exit condition has been set using thread safe semantics if (HasExitConditionBeenSet()) { break; } if (sock < 0) { printf("accept returned %d (errno==%d)\n", sock, errno); } else { HandleNewNetworkCondition(sock, &listenaddr); } } DoSomeImportantCleanup(); // close listen socket, close connections, cleanup etc.. return NULL; } void SignalHandler(int sig) { printf("Caught CTRL-C\n"); } void NotifyWorkerThreadToExit(pthread_t thread_handle) { // signal thread to exit } int main() { void* ptr_ret= NULL; pthread_t workerthread_handle = 0; pthread_create(&workerthread, NULL, WorkerThread, NULL); signal(SIGINT, SignalHandler); sleep((unsigned int)-1); // sleep until the user hits ctrl-c printf("Returned from sleep call...\n"); SetThreadExitCondition(); // sets global variable with barrier that worker thread checks on // this is the function I'm stalled on writing NotifyWorkerThreadToExit(workerthread_handle); // wait for thread to exit cleanly pthread_join(workerthread_handle, &ptr_ret); DoProcessCleanupStuff(); }

    Read the article

  • forkpty - socket

    - by Alexxx
    Hi, I'm trying to develop a simple "telnet/server" daemon which have to run a program on a new socket connection. This part working fine. But I have to associate my new process to a pty, because this process have some terminal capabilities (like a readline). The code I've developped is (where socketfd is the new socket file descriptor for the new input connection) : int masterfd, pid; const char *prgName = "..."; char *arguments[10] = ....; if ((pid = forkpty(&masterfd, NULL, NULL, NULL)) < 0) perror("FORK"); else if (pid) return pid; else { close(STDOUT_FILENO); dup2(socketfd, STDOUT_FILENO); close(STDIN_FILENO); dup2(socketfd, STDIN_FILENO); close(STDERR_FILENO); dup2(socketfd, STDERR_FILENO); if (execvp(prgName, arguments) < 0) { perror("execvp"); exit(2); } } With that code, the stdin / stdout / stderr file descriptor of my "prgName" are associated to the socket (when looking with ls -la /proc/PID/fd), and so, the terminal capabilities of this process doesn't work. A test with a connection via ssh/sshd on the remote device, and executing "localy" (under the ssh connection) prgName, show that the stdin/stdout/stderr fd of this process "prgName" are associated to a pty (and so the terminal capabilities of this process are working fine). What I am doing wrong? How to associate my socketfd with the pty (created by forkpty) ? Thank Alex

    Read the article

  • linux raw socket programming question

    - by user194420
    Hi all, I am trying to create a raw socket which send and receive message with ip/tcp header under linux. I can successfully binds to a port and receive tcp message(ie:syn) However, the message seems to be handled by the os, but not mine. I am just a reader of it(like wireshark). My raw socket binds to port 8888, and then i try to telnet to that port . In wireshark, it shows that the port 8888 reply a "rst ack" when it receive the "syn" request. In my program, it shows that it receive a new message and it doesnot reply with any message. Any way to actually binds to that port?(prevent os handle it) Here is part of my code, i try to cut those error checking for easy reading sockfd = socket(AF_INET, SOCK_RAW, IPPROTO_TCP); int tmp = 1; const int *val = &tmp; setsockopt (sockfd, IPPROTO_IP, IP_HDRINCL, val, sizeof (tmp)); servaddr.sin_family = AF_INET; servaddr.sin_addr.s_addr = htonl(INADDR_ANY); servaddr.sin_port = htons(8888); bind(sockfd, (struct sockaddr*)&servaddr, sizeof(servaddr)); //call recv in loop

    Read the article

  • Java Socket Returns True

    - by ikurtz
    I hope you can help. Im fairly new to progamming and Im playing around with java Sockets. The problem is the code below. for some reason commSocket = new Socket(hostName, portNumber); is returning true even when it has not connected with the server (server not implemented yet!). Any ideas regarding this situation? For hostName Im passing my local machine IP and for port a manually selected port. public void networkConnect(String hostName, int portNumber){ try { networkConnected = false; netMessage = "Attempting Connection"; NetworkMessage networkMessage = new NetworkMessage(networkConnected, netMessage); commSocket = new Socket(hostName, portNumber); // this returns true!! System.out.println(commSocket.isConnected()); networkConnected = true; netMessage = "Connected: "; System.out.println("hellooo"); } catch (UnknownHostException e){ System.out.println(e.getMessage()); } catch (IOException e){ System.out.println(e.getMessage()); } } Many thanks. EDIT: new Socket(.., ..); is blocking isnt it? i thought in that case if that was processed without exceptions then we have a true connection?

    Read the article

  • Socket isn't listed by netstat unless using certain ports

    - by illuzive
    I'm a computer science student with a few years of programming experience. Yesterday, while working on a project (Mac OS X, BSD sockets) at school, I encountered a strange problem. I was adding several modules to a very basic "server" (mostly a bunch of functions to set up and manage an UDP socket on a certain port). While doing this, I started the server from time to time in order to see that everything worked like it should. I've been using port 32000 during the development of the server. When I start the server and run netstat, the socket is listed as expected. > netstat -p UDP | grep 32000 udp46 0 0 *.32000 *.* However, when I run the server on other ports (random (10000 - 50000)), it's not listed by netstat. My thought was that I had somehow hard coded the port somewhere in the code, but that's not the case. The thing is - I can connect to the socket on any of the tested ports, and it reads data sent to it without any problem at all. It just doesn't get listed by netstat. What I wonder, is if anyone of you have any idea of why this happens? Note: Although this is a project at school, it's not homework. This is just something I want to understand for my own benefit.

    Read the article

  • How to send XML data through socket InputStream

    - by THeK3nger
    Hi, I'm trying to write a client-server application in Java with an XML-based protocol. But I have a great problem! See this part of client code: InputStream incoming = skt.getInputStream(); //I get Stream from Socket. OutputStream out = skt.getOutputStream(); [...] XMLSerializer serializer = new XMLSerializer(); //This create an XML document. tosend = WUTPClientWriter.createMessage100(projectid, cpuclock, cpunumber); serializer.setOutputByteStream(out); serializer.serialize(tosend); At this point server fall in deadlock. It wait for EOF but I can't send it because if I use out.close(); or skt.shutdownOutput(); I close Socket and I must keep alive this connection. I can't send '\0' becouse I get Parse Error in the server. How can I do? Can I "close" output stream without close socket? RESOLVED I've created new class XMLStreamOutput and XMLStreamInput with advanced Stream gesture.

    Read the article

  • python socket related question.

    - by paul
    Hello,All im totally new to socket programming in python. i was read some tutorial and manual, but i didn't found what i want to make python related socket script in manual or tutorial. i want to make socket script which can send some info to server and also receive some info from server. For example, i want to send my login information to server, and want to receive result reply from server. but i have no idea..how to send my login information(id and password) to server. i was captured with wireshark, some process to send login info to server. and i was found port number is 5300 and server ip is 58.225.56.152 and i was send id is 'aaaaaaa' and password 'bbbbbbb' and i was received 'USER NOT FOUND' result from server. how can i make this kind of process with python socket ? if anyone help me some reference or some example or anything help much appreciate! 0000 00 50 56 f2 c8 cc 00 0c 29 a8 f8 c0 08 00 45 00 .PV.....).....E. 0010 00 e2 2a 19 40 00 80 06 d0 55 c0 a8 cb 85 3a e1 ..*[email protected]....:. 0020 38 98 05 f3 15 9a b9 86 62 7b 0d ab 0f ba 50 18 8.......b{....P. 0030 fa f0 26 14 00 00 50 54 3f 09 a2 91 7f 13 00 00 ..&...PT?....... 0040 00 1f 14 00 02 00 00 00 00 00 00 00 07 00 00 00 ................ 0050 61 61 61 61 61 61 61 50 54 3f 09 a2 91 7f 8b 00 aaaaaaaPT?...... 0060 00 00 1f 15 00 08 00 00 00 07 00 00 00 61 61 61 .............aaa 0070 61 61 61 61 07 00 00 00 62 62 62 62 62 62 62 01 aaaa....bbbbbbb. 0080 00 00 00 31 02 00 00 00 4b 52 0f 00 00 00 31 39 ...1....KR....19 0090 32 2e 31 36 38 2e 32 30 33 2e 31 33 33 30 00 00 2.168.203.1330.. 00a0 00 4d 69 63 72 6f 73 6f 66 74 20 57 69 6e 64 6f .Microsoft Windo 00b0 77 73 20 58 50 20 50 72 6f 66 65 73 73 69 6f 6e ws XP Profession 00c0 61 6c 20 53 65 72 76 69 63 65 20 50 61 63 6b 20 al Service Pack 00d0 32 14 00 00 00 31 30 30 31 33 30 30 35 33 31 35 2....10013005315 00e0 37 38 33 37 32 30 31 32 33 03 00 00 00 34 37 30 783720123....470 0000 00 0c 29 a8 f8 c0 00 50 56 f2 c8 cc 08 00 45 00 ..)....PV.....E. 0010 00 28 ae 37 00 00 80 06 8c f1 3a e1 38 98 c0 a8 .(.7......:.8... 0020 cb 85 15 9a 05 f3 0d ab 0f ba b9 86 63 35 50 10 ............c5P. 0030 fa f0 5f 8e 00 00 00 00 00 00 00 00 .._......... 0000 00 0c 29 a8 f8 c0 00 50 56 f2 c8 cc 08 00 45 00 ..)....PV.....E. 0010 00 4c ae 38 00 00 80 06 8c cc 3a e1 38 98 c0 a8 .L.8......:.8... 0020 cb 85 15 9a 05 f3 0d ab 0f ba b9 86 63 35 50 18 ............c5P. 0030 fa f0 3e 75 00 00 50 54 3f 09 a2 91 7f 16 00 00 ..>u..PT?....... 0040 00 1f 18 00 01 00 00 00 0e 00 00 00 55 73 65 72 ............User 0050 20 4e 6f 74 20 46 6f 75 6e 64 Not Found

    Read the article

  • How large should my recv buffer be when calling recv in the socket library

    - by Silmaril89
    Hi, I have a few questions about the socket library in C. Here is a snippet of code I'll refer to in my questions. char recv_buffer[3000]; recv(socket, recv_buffer, 3000, 0); First, How do I decide how big to make recv_buffer? I'm using 3000, but it's arbitrary. Second, what happens if recv() receives a packet bigger than my recv_buffer? Third, how can I know if I have received the entire message without calling recv again and have it wait forever when there is nothing to be received? And finally, is there a way I can make a buffer not have a fixed amount of space, so that I can keep adding to it without fear of running out of space? maybe using strcat to concatenate the latest recv() response to the buffer? I know it's a lot of questions in one, but I would greatly appreciate any responses.

    Read the article

  • Reusable socket

    - by Andrew
    I tryed to create a socket in php and reuse it from other process. I know this can be done with a daemon script but I want to do this without. I created a socket and binded it to a specific port. $sock = socket_create (AF_INET, SOCK_STREAM, SOL_TCP); socket_set_option ($sock, SOL_SOCKET, SO_REUSEADDR, 1); socket_bind ($sock, 'xx.xx.xx.xx', 10000); socket_connect ($sock, $host, $port); And from another php file I did the same thing. But the packets that I send from the 2 file are not "validated" by host. I sniffed all ports and I see that it uses same local and destination port. I don't understand where is the problem. Can you help me with this? It's ok in any other programming language, or any other solution for this. Andrew

    Read the article

  • parallel-python error: RuntimeError("Socket connection is broken")

    - by user288558
    I am using a simple program to send a function: import pp nodes=('mosura02','mosura03','mosura04','mosura05','mosura06', 'mosura09','mosura10','mosura11','mosura12') nodes=('miner:60001',) def pptester(): js=pp.Server(ppservers=nodes) js.set_ncpus(0) tmp=[] for i in range(200): tmp.append(js.submit(ppworktest,(),(),('os',))) return tmp def ppworktest(): import os return os.system("uname -a") the result is: wkerzend@mosura:/home/wkerzend/tmp/ppython_test>ssh miner "source ~/coala_python_setup.sh;ppserver.py -d -p 60001" 2010-04-12 00:50:48,162 - pp - INFO - Creating server instance (pp-1.6.0) 2010-04-12 00:50:52,732 - pp - INFO - pp local server started with 32 workers 2010-04-12 00:50:52,732 - pp - DEBUG - Strarting network server interface=0.0.0.0 port=60001 Exception in thread client_socket: Traceback (most recent call last): File "/usr/lib64/python2.6/threading.py", line 525, in __bootstrap_inner self.run() File "/usr/lib64/python2.6/threading.py", line 477, in run self.__target(*self.__args, **self.__kwargs) File "/home/wkerzend/python_coala/bin/ppserver.py", line 161, in crun ctype = mysocket.receive() File "/home/wkerzend/python_coala/lib/python2.6/site-packages/pptransport.py", line 178, in receive raise RuntimeError("Socket connection is broken") RuntimeError: Socket connection is broken

    Read the article

  • Socket Communication in C#- IP-Port

    - by Ahmet Altun
    I am testing my socket programs at home, in local network. Server and client programs are running on seperate machines. Server program socket is binded as: serverSocket.Bind(new IPEndPoint(IPAddress.Parse("127.0.0.1"), 8999)); Client program (on the other computer) is connected as: clientSocket.Connect(IPAddress.Parse("192.168.2.3"), 8999); Why can Client not communicate with server? Do I need to make some firewall configuration or something like that? Or am I writing Server Ip incorrectly to the Client? (I got it from cmd-ipconfig of server)

    Read the article

  • Tcp Socket Closed

    - by Michael Covelli
    I always thought that if you didn't implement a heartbeat, there was no way to know if one side of a TCP connection died unexpectedly. If the process was just killed on one side and didn't exit gracefully, there was no way for the socket to send FIN or let the other side know that it was closed. (See some of the comments here for example http://www.perlmonks.org/?node_id=566568 ) But there is a stock order server that I connect to that has a new "cancel all orders on disconnect feature" that cancels live orders if the client dis-connects. It works even when I kill the process on my end, and there is definitely no heartbeat from my app to it. So how is it able to detect when I've killed the process? My app is running on Windows Server 2003 and the order server is on Suse Linux Enterprise Server 10. Does Windows detect that the process associated with the socket is no longer alive and send the FIN?

    Read the article

  • Using sys/socket.h functions on windows

    - by BSchlinker
    Hello, I'm attempting to utilize the socket.h functions within Windows. Essentially, I'm currently looking at the sample code at http://beej.us/guide/bgnet/output/html/multipage/clientserver.html#datagram. I understand that socket.h is a Unix function -- is there anyway I can easily emulate that environment while compiling this sample code? Does a different IDE / compiler change anything? Otherwise, I imagine that I need to utilize a virtualized Linux environment, which may be best anyways as the code will most likely be running in a UNIX environment. Thanks.

    Read the article

  • [Linux] domain socket "sendto" encounter "errno 111, connection refused"

    - by z.cHris
    I am using domain socket to get values from another process, like A to get a value from B, It works well for months. But recently, A is failed during "sendto" message to B with "errno 111, connection refused" occasionally. I checked the B domain socket bind file, it is exists. I also do some tests in another machine, also works well. So, does anyone encounter this problem before? Can anyone have some clues what might be probably wrong in this scenario? Thanks very much.

    Read the article

  • Python, implementing proxy support for a socket based application (not urllib2)

    - by Terry Felkrow
    Hey guys, I am little stumped: I have a simple messenger client program (pure python, sockets), and I wanted to add proxy support (http/s, socks), however I am a little confused on how to go about it. I am assuming that the connection on the socket level will be done to the proxy server, at which point the headers should contain a CONNECT + destination IP (of the chat server) and authentication, (if proxy requires so), however the rest is a little beyond me. How is the subsequent connection handled, specifically the reading/writing, etc... Are there any guides on proxy support implementation for socket based (tcp) programming in Python? Thank you

    Read the article

  • Confusion in bind call in socket programming

    - by Tarun
    i was learning socket programming in unix using c/c++. I am confused with one function call bind(params..). Actually it takes the adreess structure "sockaddr_in" and we can create the structure in the following way sockaddr_in.*** = somthing.. sockaddr_in..s_addr htonl(INADDR_ANY) **Passing INADDR_ANY will alow to bind all local addresses** My question is , why do we need to use "INADDR_ANY" ? In my knowledge every machine can has only one unique IP Address. In this way there is only one address associated with the machien. Thye bind call should directly bind the socket to the single available address. Please explain what are the different scenarios and why is it so?

    Read the article

  • When to use Nginx PHP Fast CGI with a TCP socket instead of a UNIX socket?

    - by user64204
    I've followed this guide to setup PHP in FastCGI mode with Nginx. This guide describes 2 ways of doing it: TCP socket and UNIX socket. I've ran some Apache Benchmark on my locale machine and here are the results: Below tests ran multiple times to get better average statistics: $ ab -c 200 -n 100000 http://.... APACHE: 1800 req/sec NGINX (TCP socket): 2500 req/sec NGINX (UNIX socket): 15000 req/sec As far as I understand, there is overhead with using a TCP socket rather than a UNIX socket, hence the better performance with the latter. However I was not expecting such a performance difference given that the TCP socket is on the localhost, and therefore would like to ask the following question: Q: Given the huge performance gain with using a UNIX socket, what are the configuration scenarios where it would make sense to use a TCP socket instead?

    Read the article

  • Correct usage of socket_select().

    - by Mark Tomlin
    What is the correct way to use socket_select within PHP to send and receive data? I have a connection to the server that allows for both TCP & UDP packet connections, I am utilizing both. Within these connections I'm both sending and receiving packets on the same port, but the TCP packet will be sent on one port (29999) and UDP will be sent on another port (30000). The transmission type will be that of AF_INET. The IP address will be loopback 127.0.0.1. I have many questions on how to create a socket connection within this scenario. For example, is it better to use socket_create_pair to make the connection, or use just socket_create followed by socket_connect, and then implement socket_select? There is a chance that no data will be sent from the server to the client, and it is up to the client to maintain the connection. This will be done by utilizing the time out function within the socket_select call. Should no data be sent within the time limit, the socket_select function will break and a keep alive packet can then be sent. The following script is of the client. // Create $TCP = socket_create(AF_INET, SOCK_STREAM, SOL_TCP); $UDP = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP); // Misc $isAlive = TRUE; $UDPPort = 30000; define('ISP_ISI', 1); // Connect socket_connect($TCP, '127.0.0.1', 29999); socket_connect($UDP, '127.0.0.1', $UDPPort); // Construct Parameters $recv = array($TCP, $UDP); $null = NULL; // Make The Packet to Send. $packet = pack('CCCxSSxCSa16a16', 44, ISP_ISI, 1, $UDPPort, 0, '!', 0, 'AdminPass', 'SocketSelect'); // Send ISI (InSim Init) Packet socket_write($TCP, $packet); /* Main Program Loop */ while ($isAlive == TRUE) { // Socket Select $sock = socket_select($recv, $null, $null, 5); // Check Status if ($sock === FALSE) $isAlive = FALSE; # Error else if ($sock > 0) # How does one check to find what socket changed? else # Something else happed, don't know what as it's not in the documentation, Could this be our timeout getting tripped? }

    Read the article

  • How to connect with MySQL server if it won't connect via the socket?

    - by cwd
    I have an account on a shared server. I have jailshell access and also PhpMyAdmin. I want to run mysql commands via SSH but I'm getting an error: $ mysql -u mySqlUser -p mySqlPw Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' I can connect with PHP and phpMyAdmin, so would it be possible to call mysql from the shell and have it connect via an ip and port instead of the socket? The file /var/lib/mysql/mysql.sock does not exist - maybe that is intentional, and the only thing in /etc/my.cnf is [mysqld] skip-innodb More Info I don't have access to change system settings. I did a search in /var for mysql.sock but found nothing. However, phpMyAdmin might be connecting via a socket somehow: Really it would just be great if I could connect via IP. Also tried these two syntaxes: $ mysql -u mySqlUser -p mySqlPw -h localhost $ mysql -u mySqlUser -p mySqlPw -h localhost -P 3306 Both with the same result: ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)

    Read the article

  • I/O error(socket error): [Errno 111] Connection refused

    - by Schitti
    I have a program that uses urllib to periodically fetch a url, and I see intermittent errors like : I/O error(socket error): [Errno 111] Connection refused. It works 90% of the time, but the othe r10% it fails. If retry the fetch immediately after it fails, it succeeds. I'm unable to figure out why this is so. I tried to see if any ports are available, and they are. Any debugging ideas? For additional info, the stack trace is: File "/usr/lib/python2.6/urllib.py", line 235, in retrieve fp = self.open(url, data) File "/usr/lib/python2.6/urllib.py", line 203, in open return getattr(self, name)(url) File "/usr/lib/python2.6/urllib.py", line 342, in open_http h.endheaders() File "/usr/lib/python2.6/httplib.py", line 868, in endheaders self._send_output() File "/usr/lib/python2.6/httplib.py", line 740, in _send_output self.send(msg) File "/usr/lib/python2.6/httplib.py", line 699, in send self.connect() File "/usr/lib/python2.6/httplib.py", line 683, in connect self.timeout) File "/usr/lib/python2.6/socket.py", line 512, in create_connection raise error, msg Edit - A google search isn't very helpful, what I got out of it is that the server I'm fetching from sometimes refuses connections, how can I verify its not a bug in my code and this is indeed the case?

    Read the article

  • establishing a socket connection from iPhone to MAC/PC

    - by user319572
    Hello, I just started getting into XCode and Co. What I am trying is to send accelerometer data via WLAN to a PC or MAC over a Socket connection. I am trying at the moment with the iPhone simulator, on the other site a netbook with a JAVA program shall receive a test string for starters. Unfortunately my socket will not initialize. What am I doing wrong? NSString *recStr = @"192.168.0.5"; //String with receiver IP NSHost *hoster = [NSHost hostWithName:recStr]; //create a host NSOutputStream *sendData; //create an output stream [NSStream getStreamsToHost:hoster port:8000 inputStream:nil outputStream:&sendData]; [sendData retain]; [sendData setDelegate:self]; [sendData open]; A warning says NSStream may not respond to '+getStreamsToHost:inputSream:outputStream:' So I guess parameters are wrong. But why and how to do it right? The program starts but I don't think I can send anything as long as this warning shows up (have not tried though). Thank you in advance, Andreas

    Read the article

  • select always returns -1 while trying to read from socket and stdin

    - by Aleyna
    Hello I have the following code implemented on C++(Linux) to check on my listening socket and stdin using select. select however keeps returning -1 no matter what I try to do! What's wrong with that code :s I will appreciate any help. Thanks highsock = m_sock; //listening socket memset((char *) &connectlist, 0, sizeof(connectlist)); memset((char *) &socks, 0, sizeof(socks)); int readsocks; struct timeval timeout; timeout.tv_sec = 60; timeout.tv_usec = 0; while (1) { updateSelectList(); //cout << "highest sock: " << highsock << endl; tempreadset = readset; readsocks = select(highsock+1, &tempreadset, NULL, NULL, &timeout); //cout << "# ready: " << readsocks << endl; if (readsocks < 0) { if (errno == EINTR) continue; cout << "select error" << endl; } if (readsocks > 0) { readFromSocks(); } } void readFromSocks() { if (FD_ISSET(STDIN, &readset)) { ... } else if (FD_ISSET(m_sock, &readset)) { ... } } void updateSelectList() { FD_ZERO(&readset); FD_SET(STDIN, &readset); FD_SET(m_sock, &readset); for (int i=0; i<MAXCONNECTIONS; i++) { if (connectlist[i] != 0) { FD_SET(connectlist[i], &readset); if (connectlist[i] > highsock) highsock = connectlist[i]; } } highsock = max(max(m_sock, STDIN), highsock); }

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >