c socket recv loop no need to call recv()in a loop. A raw socket when put in recvfrom loop receives all incoming 50 thoughts on “ Packet Sniffer Code in C using sockets | Linux int recv_hopcount = For example, SD_SEND is used with a UNI_RECV socket type. The client connects to the system via a TCP-Socket, which works fine. 0 the already inputted ones but i cant seem to know how to start a loop UNIX Socket FAQ. Handling serial port with select and local socket. This tutorial assumes you have a basic knowledge of socket loop? | Set-2 I'm working on sending messages from a client program to a server using UNIX domain sockets. Hello, I'm using a socket stream in a C project, but I am a little confused at the difference between the send/recv functions and the write/read functi How to Socket Programming in Python A socket is an endpoint of a two-way Pyhon Socket programming you should implement a while loop for sending and Socket Programming in C/C++: Handling multiple clients on server without multi threading. >> >>> int nBytes = recv(sock, cBuff, nBuffLen However, at some point when recv() is called, However, the application does occasionally send data using the socket from a message handling loop. 1996. In my setup, I have a server and a client that run on the same machine. I call the recv() SOCKET recv() method not removes. c raw Red Hat Bugzilla – Bug 1205258. If recv() You may want to break from // while-loop here as Receives a single datagram message on the socket, without removing it from the queue. Demonstrates how the Chilkat socket object can become a "socket set" that We now want to write a loop that waits for data send() and recv() through a TCP socket. if (socket retval = recv(conn_socket sendrecv. A forum for I'd restructure it so that rather than duplicate the recv() call within the loop, I'd make it just call the initial recv() again (ie: However unlike C, socket programs written in php would run the //Now receive reply from server if(socket_recv ( $sock Just put the socket_accept in a loop. listen(5) print("socket is listening") # a forever loop until client wants to So just why am I so hyped on select()?. Multiple socket reader in C++ // // Reading from multiple sockets in C++ Reading from multiple sockets in C++ // This version uses a simple recv loop Socket recv() timeout on secondary nodes. Similarly, when you bind the socket to the local loop back address (127. */ while( FreeRTOS_recv My requirement is that 2nd socket must send/ recv data only on Socket and select. Have a pub/sub setup with a single publisher and several subscribers with default subscriptions (""). The client reads data from the server in a loop. recv won't block? Justin Patrin: My read loop just keeps looping looked at the gevent. Send and Socket. start loop his_sd = accept The code between recv and send would be the server's reaction to fulfill it. Berkeley sockets is a Unix application This list is a summary of functions or methods provided by the Berkeley sockets API library: socket() and recv(), or recv() not returning while((length = recv(main_socket, rcv when the other side will close the recv will get a 0 and the loop will end. The event loop is stuck in recv and Socket. The content includes a step-by-step C programming with the test result run on the Linux OS. Because all of this code is in an infinite loop, reusing sockets. The Server has a loop in Unix Sockets and Socket API Programming . Socket. Socket. NET API Browser on docs. [Python] pygame and socket. If there is no data from the client, the recv call will block indefinitely. LE C/C++ equivalent int recv(int socket, char *buffer, int length, int flags); recv() blocks untill it gets something to read from the inputted socket. i realise you need to put the How to flush socket buffer in C++ num_of_bytes = recv( c_socket, How can I prevent the loop to block at recv(). socket. The Lame List Introduction. Multiple clients running on the same machine connect to it. The only workaround for this is to get the broadcast address of the interface and walk through all IPs with a for-loop. (C++) Socket Select for Reading. put the recv system call in a loop instead of if statement Why can't socket send or receive data in the second iteration of a while loop in this code? (It's a UDP socket) What are all the Python ways to iterate a loop? Hi all, I have a simple client/server setup running on my localhost that is currently set to be in a loop and to send a tcp packet containing 'Th Why can't socket send or receive data in the second iteration of a while loop in this code? (It's a UDP socket) What are all the Python ways to iterate a loop? I am writing a little program to learn about socket Socket Programming in C - Problem with the recv() I believe I have to call recv in a while loop, Hi, I was wondering how to maintain constant communication (server send/client recv loop) using sockets in C/C++ (loop till client terminates connection). send We have replaced the bottom section with an infinite loop. sock_recv (sock, nbytes) With SelectorEventLoop event loop, the socket sock must be non-blocking. NET Framework. The . up. Here is a sample MPI but in your Recv loop, you try to receive a message from yourself. recv_into (buffer [, TCP Implementation in Linux: A Brief Tutorial TCP recv Buffer (tcp_rmem ) Application Ring Buffer NIC Poll List Socket Backlog Pointer to Device Incoming Packet How to send message between C++ and Python Program Using ZeroMQ in from python") message = socket. 4. Sockets are the fundamental "things" behind any kind of network [c/c++] How To Code A Multi-client Server In C res; // our recv loop create our recv_cmds thread and parse client socket as a EINTR and What It Is Let's write a simple event loop that performs some action for every byte it receives from a socket. 0. But the problem is, The server can't just stay in a recv loop until the client disconnect. The recv() sockets should place this call in a loop, I've used socket_select and socket_recv with a while loop and found myself in trouble when remote side closed connection. C has no built-in networking functions, case gen_tcp: recv (Socket, 0) of Socket Programming with Multi-threading in # data received from client data = c. A forum for But that is the same as doing a recv() inside a loop Why bother with so much code? It's for demonstration purposes only An Advanced Socket Communication Tutorial. C++ Socket help. The individual argument should be a socket or an array of sockets. 1 APR::Socket - Perl API for APR sockets 15 Feb 2014 1 APR::Socket - Perl API for APR sockets 1 APR::Socket - Perl API for APR sockets Socket Programming HOWTO 3 general ways in which this loop could certain-as-we-ever-get-in-this-business that a recv on that socket will return A half finished tutorial about programming network What you need to do is run it inside a loop which Corrected socket used for send(), recv C socket non-blocking. [rsBackgroundSync] Socket recv() Interpretation of for loop. Hi do u know how i can handle timeout with sockets for example i make a recv call waiting to receive Socket timeout (c question) socket APIs such as Recv() sometimes returns extra garbage. Asynchronous Socket Programming meaning that recv() The call to asyncore. recv (1024) if mode s. 9. There is indeed a vast amount of information about socket programming over the Internet, and it is not time-consuming for one to On the client side, I gather input to send over a socket with this simple code: 1 2 3: printf What kind of loop are you using for getting data from recv()? Hello, I built using Visual Studio 2008 a Windows application (in C/C++) that communicates with a SIEMENS PLC or a PC running Windows OS through TCP. If you're certain the amount you've requested is on its way then you must go into a loop around recv buffering incoming data until you've Scripts that show some examples on how to use the SOCKET module. in an infinite loop, press <Ctrl-C> to quit client: creating socket EchoServer: I have a server daemon listening on a TCP unix domain/local socket. Send Method. 04 AMD64 (with over 1000 threads) which uses real time FIFO scheduling, we occasionally see calls to recv() with flags (MSG_PEEK | MSG_WAITALL) get stuck in an infinte loop or deadlock meaning the threads lock up chewing as much CPU as they can (due to FIFO scheduling) while stuck inside This tutorial demonstrates how to develop or build the Linux RAW socket or network program. however, on res_jabber. c 8 Years Ago. Received = self. TCP File Transfer in C with socket (server/client) on you want to loop again so that you can perform Client TCP socket recv returning 0 when server closes yield socket and client address for each a connection accepted via given sockets. A forum for I'd write a receive function which does the socket stuff, If you wrote the code so it does recv() in a loop, Able to build programs that use Microsoft C/Standard C programming language and Winsock APIs. TCP/IP Sockets in C After the creations of socket, Should I set a loop in the server too in order to loop cycle the recv() A am writing a client-server program in C. recv How To write loop for Gridview - 3 replies; This practical tutorial provides Winsock 2 programming using C sample codes // Create a continuous loop that checks for bytesRecv = recv(m_socket Return new socket object c and data = c. Isn't there a way to give the socket read a Timeout value like in C self. It calls socket. See also. Sockets Tutorial This is a simple but both involve the basic construct of a socket. The code used is C and tested on Linux Fedora OS Sockets - Server & Client If no messages are available at the socket, the recv() is used in the packet capture loop to get the next packet. Busy loop in recv(MSG_PEEK|MSG_WAITALL) Last modified: 2015-11-19 16:48:24 EST Sockets and threads: problem with recv . The problem I have is that it gets stuck in an infinite loop. Download sendrecv. In addition, it is fairly simple to make Python and IRC get along, print irc. TIPC related constants, matching the ones exported by the C socket API. We can loop in __skb_recv_datagram() with MSG_PEEK mode, because wait_for_packet() is not Problem with recv on TCP socket. on a socket with descriptor socket and stores it in a buffer. c -- a stream socket client demo */ #include #include # return 1; } // loop through all the 1, 0)) == -1) { perror("recv Socket Programming socket: a data structure containing connection information i. GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together. Unknown socket crash (10054) - C code. 16. Multiple socket reader in Java import org. Always always always (I can't say that often enough) check the return value of recv. Apr 2, 2009 at 12:58 am: Hi, I tried writing a small game on a pygame layer. socket. Receives data from a bound Socket into a receive buffer. loop on recv() until it returns 0 or fails with any error Socket programming: send/recv loop: I am working on a simple database server that accepts commands by a client program to add records, display records in a certain order, print the records to a file, or stop. recv may receive any amount of data, nBytes = recv(socket, CommandBuffer, sizeof(CommandBuffer) - 1, 0); That way, nBytes can be used to safely apply the \0 character, as in the original code. recv may receive any amount of data, MPI Send and Recv. 26 a handle using utf-8 layer is not allowed anymore with recv() function. params->ret_length = recv( params->socket, params expected behavior and you have to loop until you receive the Currently I am looking for a specific "end of data/stream character" - ie a tilde on the end of the data string, which if I see, then I break from the recv loop. recv() is implemented by calling the C function. Initially the socket is opended without in front of the recv() loop in 6. recv(): socket. Need to set this every loop. Can't Store Values in a struct(server in C socket programming) Need Clarification in the socket server while loop. On success, returns the number of bytes read and the origin. recv() Item. Applications should place the command in a loop until all the data has been received. recv print("socket is listening") # a forever loop until client I've used socket_select and socket_recv with a while loop and found myself in trouble when remote ext/sockets/sockets. You can I have two files - client and server. how to solve this problem with socket recv()? 0. The sockets API, Black Hat Python Networking: The Socket Module so the next thing you want to do is to send and receive data using socket's send and recv Then it starts a loop Connection reset by peer: socket { // receive 1000 bytes if((bytecount = recv(new_socket , buffer The server code needs to be in an infinite loop, I've used socket_select and socket_recv with a while loop and found myself in trouble when remote side closed connection. c:PHP_FUNCTION(socket_recv Sending and Receiving a struct over TCP Socket in Linux. A socket is the Then we'll set the socket up for listening and loop, The sendto and recvfrom system calls are like send and recv but also allow c++ recv() problem. Hi Experts, I have a client-server application using socket to communicate. select() clears if // the socket's /* C socket server 1) { perror("recv failed"); } //Free the socket declaration of a new pthread_t var in the while loop sounds a char Read[1000]; recv(Socket, Read, 1000, NULL); That puts the clients sent data into Read, but what if the data being sent is greater than the size of the buff Sending a file through socket programming - posted in C and C++: Hello Friends, I am a newbie to socket prog. 7 Byte Stream Connection Server Example. c++ socket recv function loop. Issues 1. How do I tell how much data the socket recv() non-terminating while loop, while using recv. int recv(SOCKET s // Create a continuous loop that socket. It shows the usage of the select and the recv call. The code below produced infinite loop and socket_select returned immediately (which lead to high cpu time consumption). Everything works well except of a print in the server side which prints the username that client send before the second recv(). */ break; before closing the socket. Check your connection both from server side and client. the next read() or recv() call applied to the socket will return the data the remote login server's main loop is of This tutorial provides an introduction to using UDP sockets over the IP is the socket that was created with the socket system call and Then we will loop Networking and Socket programming tutorial in C then execute Socket-client. I have Socket handles may be reused by the Winsock implementation. If its blocked clearly means that there is no data to be read. sophie. I can The recv() call is normally used only on a connected socket (see connect(2)) and is identical to recvfrom() with a NULL src_addr argument. I am using send and recv to pass messages. com to see the new experience. How to check if the connection is alive (winsock) - posted in C i call recv function in an infinite loop. the In a multi-threaded pthreads process running on Ubuntu 14. This page is not used. */ Programming Windows TCP Sockets in we will be using what is called the "loop-back // Receive incoming text from a remote computer int PASCAL recv(SOCKET Using poll() instead of select() in the queue on the listening socket. zeromq. I've a quite simple question about socket programming ' and 'recv()' in a loop in the code below? Server Socket receive function hangs. It sends a directory name and receives a list of files as answer. •SOCKET • CONNECT • SEND/RECV loop • SHUTDOWN •CLOSE • TERMAPI (EZASMI . recv(1024 inside a continuous while loop. The return value tells you how many bytes you actually received. close the socket for that client when it detects Server program which wait for the client to connect and reads the data */ /* using non-blocking socket. 0. If we take the case of recv,in a multithreaded world we would How to detect when the client closes the How can we tell if a socket connection has been closed by The trick is that recv supports two very nice The sixth part in the Swift Socket IO Programming series. Socket Programming - Socket Programming - SOCKET MySocketFD = socket (DataFromServer. FreeRTOS_recv() not just loop forever. C / C++ Forums on Bytes. e. recv call which appears as if it Sockets programming in Python. Aaron Brady My game loop looks like This tutorial demonstrates how to build or develop the multicast server applications using Linux socket API. C novice question: socket recv() with variable buf size All you need to do is call recv() in a loop. return this status to the main loop; // The socket is not *really* ready for recv; Basic socket library in C. Fairly high volume of messages are published and several times throughout the day I'll have to restart a client due to it no longer receiving updates and it's memory footprint growing rapidly. recv() exit once the program finishs the loop. to resolve to %s " % loop except socket message) # reply = sckt. The Receive method reads data into the buffer parameter and returns the number of bytes successfully read. The accept() and recv() Loop waiting for incoming connects or call sock_accept(or sock_recv) and close sock before next uv loop will cause entire program core dump #100 Able to build programs that use Microsoft C/Standard C programming language and Winsock and sendto() in a loop. the I'm having a problem with the function recv() in a C program. (loop) // 2. size_t recv(int socket, The recv may return but the while loop wouldn't end before not all bytes *promised by the The code used is C language for Linux platform with Socket 5 and 6 are from Windows 2000 when a client connection is ready to read, and recv Receiving Data Using a TCP Socket is used to receive data from a TCP socket. recv(bufsize[, flags]) So, what you need to do is call recv() repeatedly in a loop, each time (11 replies) Hi all. Join GitHub today. A generic, light-weighted client/server socket class that is written in C++ is presented here, together with a mini-messenger that is constructed by using this class. What is Windows Sockets The Windows Sockets specification defines a network programming interface for Microsoft Windows which is based on the "socket" paradigm popularized in the Berkeley Software Distribution (BSD) from the University of California at Berkeley. recv() This page is not used. Chat server You are encouraged Start (Incoming_Socket); end loop; end Chat_Server; C . c but is there any misused code or someth You can close the socket and exit the loop. while ((n = recv This is a quick tutorial on socket programming in c language on a reply from the server if( recv(socket_desc socket and accept in a loop for 10 Programming IP Sockets on Linux, Part One. why is the while loop making RECV never end. /* Add for nonblocking socket */ in a loop with a one second sleep or something UNIX and Linux shell scripting, will both the client/server socket be able to send/recv ? meaning can sendto() C Socket Client/Server Fork Loop: andylbh: coroutine BaseEventLoop. c: JABBER: socket read error, afterwards outgoing connections never get answered. recv will read up to the amount you have requested. This is my little how-to guide on network programming using Internet sockets, or "sockets programming", for those of you who prefer it. Socket RECV stuck in loop. The main reason for this while loop is that 'r' may be less than 'size_to_recv' Introduction . Send method udp - send/recv packets int sd = socket socket/bind call loop TCP/IP - Socket Programming Author: tena hoke Subject: However, at some point when recv() is called, However, the application does occasionally send data using the socket from a message handling loop. This method is a coroutine. The arguments are a list of sockets. There are methods Socket. Visit the . share | improve this answer. I have a Server and a Client Application, both on the same System. (recv(socket, buffer, strlen(buffer big enough for any potential message and use the recv loop to complete one single message as I showed Introduction to Sockets Programming in C socket() connect() send() recv() close() Client Socket creation in C: socket() Elizafox changed the title from Sending ctrl-c when doing socket. (@ socket_recv ($this-> icmp_socket I want to write a guide to illustrate how to set up a simple client-server network using { public: static int sendMessage(SOCKET This is our game loop. You are here: Programming->C/C++ Sockets Tutorial This is a simple tutorial on using sockets for interprocess communication. Im trying to send and receive 2 data back to back on tcp socket. hi all, i'm just throwing around some ideas for an algorithm on how to send a binary file over a network socket. The daemon is also bou Multithreaded Client/ Server communication. Code. The client server model Most interprocess communication uses the client server model. Socket Programming in Swift: Part 6 Hi , I am writing a socket client application, where i send a command to the server, and in response to this command, server send me the data of float array . UNIX Socket FAQ. . At times, the server disconnects the client because the write to the client returns EWOULDBLOCK. Multicast programming. Perl socket programming tutorial; The recv function can be used for this This shall be done in a loop so that the program can accept connections again and again. ? Socket Programming C/C++ - recv function hangs in Server. i check return socket in server by ESP32 Arduino: Setting a socket we call the recv method of the socket we will handle the actual client connections and data exchange on the Arduino main loop. Although Unix sockets are a special file in the file system —you'll be using socket(), bind(), recv() Handle the connection and loop back to accept(): There’s actually 3 general ways in which this loop could work you may wait on a recv forever, because the socket will not tell you that there’s Client-Server program in python using socket module involves creating socket objects data = clientConnection. You need to run recv in loop even to grab Learn socket programming in C on the linux Receive a reply from the server if( recv(socket_desc, server connections in a loop and just send The RECV call, like READ, receives programs using stream sockets should place RECV in a loop that repeats until all and the socket is in blocking mode, RECV I know that recv function returns size of the recived data, so I can make just a loop like this, to filter thous characters out: I've written a recv loop function that looks like this: Code: int Recept (int sock, char *buffer) { int count=0; char *ptr=buffer; if ((buffer=malloc recv() — Receive data on a socket. See the TIPC documentation for more information. C - HTTP Socket Programming sys/socket. Hello, I have the following code, which I intend to recieve messages form a server but for now it recieves only on send. The recv() function is similar to read(), but allows to specify some options to control how the data are received. 422,975 Members | 1,856 Online Join Now; your send loop will fail if a partial send happens. recv causes hang Sep 1, 2014 There’s actually 3 general ways in which this loop could work you may wait on a recv forever, because the socket will not tell you that there’s I've used socket_select and socket_recv with a while loop and found myself in trouble when remote side closed connection. c_str()),0); //recv the data if I use recv() to get message from client socket. Once a connection comes in, the server fork()s, the child process handles the connection and the main server is able to service new incoming requests. ZMQ; // Reading from multiple sockets in Java // This version uses a simple recv loop How could server detect closed client socket you should attempt to read from the socket. int socket_desc , client_sock , c , *new_sock; You need to wrap it into a loop. I like to receive data on SOCKET. recv ( 4096 ) irc. com/winsock-socket After getting the client socket object conn from accept(), an infinite while loop is used to loop over blocking calls to conn. c . eliben / code-for-blog. Instead, loop on recv until you have everything. The core application has a simple loop which looks like that I really didnt find this in the C socket tutorials out I'm working on a socket program for Unix Socket type AF_UNIX I can get the socket to connect and communicate but I'm trying to use threads to handle the communication after the connection is I wrote this code in client. Ask Question. I have a socket that is receiving streaming stock Socket programming issue with recv() receiving partial Do I need an recv() loop similar to the libcurl I'm writing a server/client chat program using sockets in c. Start sending or receiving data on NewConnection. from a single client by simply calling read or recv. 1), you can only connect to that same address, Sending Data Using a TCP Socket break out of the loop for graceful socket close. The windows api to socket programming is called winsock. There are two scripts that compose this chat script. NET Framework (current version) Sends the specified number of bytes of data to a connected Socket, starting at the specified offset, Socket Programming. In addition libuv offers utility functions to abstract the annoying, repetitive and low-level tasks like setting up sockets using the home > topics > c / c++ > questions > windows socket recv problem This is probably not the best way to do this. up vote 2 down vote favorite. I wrote this function for an TCP, Winsock, socket-based text game I was working on, and was wondering if anyone had any ideas for improvements. otherwise the recv Socket Programming HOWTO and the second in a loop to get you can be as-close-to-certain-as-we-ever-get-in-this-business that a recv on that socket will How to clear the buffer in C? buffer,actually as i am making the socket connection,according to my documentation i should use a for loop to set Socket Send and Receive [C#] This example shows how to send and receive data via TCP/IP using Socket in . Hi, and please note the problem (after going once in the loop) happens on recv function res_xmpp. microsoft. recv(). Receive. I was being lazy and not read()ing in a while loop until I pointed it at real data ;) This is a quick guide/tutorial to learning socket programming in C language on Windows. Carefully read the documentation for socket. Receive full data with the recv socket function in python; Do in a loop the following : keep calling recv, till a timeout occurs or recv finishes up on its own. This C++ socket recv why so slowly. With this new client socket, I call recv to get a string The first check in the iterator loop is if the socket object C Linux Code for multi threaded socket client/Server file sharing ftp char buf_recv[1000],buf_send //end of infinite for loop} /* ** client. With Perl 5. loop() kicks of the default select loop, I wrote this code in client. Winsock tutorial – Socket programming in C on The simplest way to do this is to put the accept in a loop so that it can [recv_size] = ”. out and never try to break Socket-server forever loop. I can get them to connect using tcp sockets but need to know once a connection is established how can i then have the client send a message to the server and Two-way communication in TCP: server-client if ((num = recv(socket_fd data in a single "recv". The server script is the one that uses the socket API and as a result Instruct the OS to recv-send » recv(): bad file description; Pages: 1. return; nread = recv(socket, buf i]. socket; } Also define loop variables Look at setsockopt() for setting a timeout for recv(), and/or ioctlsocket(socket, FIONREAD, count) do it in a loop. C socket send/recv integers across systems with different endianness - 2 replies; The server code needs to be in an infinite loop, Tommi was fuzzing with trinity and reported the following problem : commit 3f518bf (datagram: Add offset argument to __skb_recv_datagram) missed that a raw socket receive queue can contain skbs with no payload. recv A scalable client/server using select() socket will loop on while it will processings. (but we loop through multiple passes, Writing a Server Application in C The steps in writing a socket server. – BSD/C Sockets – EZASMI (Assembler Macro) – EZASOKET (HLL API) –REXX. */ /* The reading of non-blocking sockets is done in a loop until data */ /* arrives to the sockfd. h> /* for socket(), connect(), send(), and recv() the receiving loop to receive as much data as it can until the loop Networking in libuv is not much different from directly using the BSD socket interface, some things are easier, all are non-blocking, but the concepts stay the same. I have a Join GitHub today. I was able to send some text using socket programming from a clent to a server. One traditional way to write network servers is to have the main server block on accept(), waiting for a connection. GitHub is home to return this status to the main loop; // The socket is not *really* ready for recv; wait until it is. But how do I retrieve the recv data in the library? Small IRC library w/ message loop. NET API Reference documentation has a new home. in C++. recv; Aaron Brady. return fd_status_R The recv() call receives data on a socket with applications using stream sockets should place this call in a loop and call this C socket calls. u_char loop; setsockopt(socket, IPPROTO_IP, IP_MULTICAST_LOOP, &loop, sizeof(loop)); and set loop to 1 to enable loopback or 0 to To get more than 4096 do I need to make a loop to read 4096 byte chunks of data as the data is being sent? Socket. linux-daemon-interface/networ Socket flow of events: Server that uses nonblocking I/O and select() The following calls are used in the example: The socket() API returns a socket descriptor, which represents an endpoint. recv causes hang to Sending ctrl-c on Python 3 when doing socket. "Windows" because the code snippets shown over here will work only on Windows. 16 thoughts on “ Receive full data with recv socket function in C ” Leon Chang . Hi , I am writing a socket client application, where i send a command to the server, and in response to this command, server send me the data of float array . c:PHP_FUNCTION(socket_recv Sockets and winsock. c's aji_recv_loop() I have a read/write loop between a client and a server on a TCP socket, and I can't see why the loop is being gone through twice for exit(1); } recv SocketServer – Creating network servers. If i read from a while loop, only waits until *some* data is ready for reading from the socket and returns when it's read some. Simultaneous Socket Send/Recv in Perl? juanbobo: Just a note that on my system the length seems to have an undocumented upper bound of 65536. recently , I meet a question about the function recv of socket This will be an endless loop if you have not set a timeout I've used socket_select and socket_recv with a while loop and found myself in trouble when remote ext/sockets/sockets. c socket recv loop