Questions tagged [recv]

BSD Sockets function used for receiving data from a TCP socket.

670 questions
5
votes
2 answers

curl (56) Recv failure

While running the command: curl --head http://www.yourdomain.com/ on my local machine, I get this output: HTTP/1.1 200 OK Date: Sat, 31 Mar 2012 09:45:16 GMT Server: Microsoft-IIS/6.0 X-Powered-By: ASP.NET X-AspNet-Version: 2.0.50727 Set-Cookie:…
GRaecuS
  • 236
  • 2
  • 6
  • 14
5
votes
2 answers

Java socket exception: recv failed

This is basically the picture: I have a server and a client (operating through localhost). Server creates a clientthread for each connection. this new thread blocks on read waiting for messages from client. At will, i can deactivate the server…
Bimp
  • 494
  • 2
  • 5
  • 14
5
votes
2 answers

C++ - Detours WinSock Hooking

What I am trying to do is use the Detours library to hook into an applications WinSock2 send() and recv() functions (a packet logger). While it does work for the send() function, it does not, however, work for the recv() function. Here is my…
xian
  • 4,657
  • 5
  • 34
  • 38
5
votes
3 answers

Send/Receive messages at the same time socket python

I have been working on a simple python socket chat room where the client and server can send messages to each other. The issue that I came across was that the server and client can only send one message at a time. I want it to work like any other…
Hass786123
  • 666
  • 2
  • 7
  • 16
5
votes
1 answer

Socket. How to receive all data with socket.recv()?

I have a problem with receiving data from server to client. I have the following client-side function that attempts to receive data from the server. The data sent by the server using the socket.sendall (data) function is greater than buff_size so I…
Nico Rossello
  • 65
  • 1
  • 1
  • 6
5
votes
2 answers

What value will recv() return if it receives a valid TCP packet with payload sized 0

In TCP socket programming, if recv() returns 0, it is taken as an indication that the other side closed its connection. However, AFAIK, the TCP RFC does not mandate the payload of TCP to be > 0. So, theoretically, a TCP stack can receive a message…
Aditya Sehgal
  • 2,867
  • 3
  • 27
  • 37
5
votes
2 answers

Does recv(...) operate this way?

I'm setting a timeout for the socket using SO_RCVTIMEO to 10 seconds. This question is specific to a stream socket (TCP). When I call recv(...) from what I can gather from the man pages, here is what I'm expecting: If remote closes the…
Brett
  • 4,066
  • 8
  • 36
  • 50
5
votes
1 answer

TStringStream gets corrupted when received using (winsock's) recv?

I'm working on a fairly simple Client/Server application and have some trouble receiving a TStringStream from a client using recv provided by winsock API. I keep getting this error: 'access violation at 0x00000000: read of address 0x00000000'. The…
p1.e
  • 497
  • 1
  • 4
  • 5
5
votes
2 answers

recv with non-blocking socket

I am trying to implement non-blocking for socket recv and the problem is that I got an error -1 when there in no data but I expect to get EAGAIN error. Socket is set definitely to non-blocking state, I checked flags = fcntl(s, F_GETFL, 0) for…
user1016711
  • 139
  • 1
  • 4
  • 12
4
votes
3 answers

How C++ `recv` function acts at data receving? Could it receive a partial "packet"?

static void HandlePackets(void* pParams) { int iResult = 0; char recvbuf[MAX_PACKET_LENGTH]; printf("Packet handling started\n"); while((iResult = recv(lhSocket, recvbuf, MAX_PACKET_LENGTH, 0)) > 0) printf("Bytes received: %d\n",…
Kosmo零
  • 4,001
  • 9
  • 45
  • 88
4
votes
2 answers

UDP recv/recvfrom multiple senders

Good Day, I'm developing an application in VC++ that communicates using UDP protocol with winsock on Windows XP. Previously I've been able to assume that all packets being received by the tool were from a single target. However I'm now doing a…
Ian
  • 4,169
  • 3
  • 37
  • 62
4
votes
3 answers

How should I cleanly break out of a recv loop?

I'm using the recv function in a loop to receive network data, but let's say I want to stop receiving data mid-loop. I could just break the loop, but this doesn't seem like a very clean way to stop receiving data. So is there any way to cleanly stop…
Josh
  • 6,046
  • 11
  • 52
  • 83
4
votes
4 answers

Receive TCP payloads from socket immediately (packet-by-packet) in C

How can I receive data (byte stream) from an open network socket in C on a packet-by-packet basis? I want to read data from the socket IMMEDIATELY as it arrives (as soon as the packet arrives on the machine). It seems when I perform a read() (or…
Susan
  • 41
  • 1
  • 2
4
votes
2 answers

Winsock2, client-server communication - send/recv in turns

I want to write a client/server application, in which client and server can exchange messages. Client site communication: send recv send recv Server site communication: recv send recv send However, I have a problem, because only one message is…
yak
  • 3,770
  • 19
  • 60
  • 111
4
votes
5 answers

How to correctly read data when using epoll_wait

I am trying to port to Linux an existing Windows C++ code that uses IOCP. Having decided to use epoll_wait to achieve high concurrency, I am already faced with a theoretical issue of when we try to process received data. Imagine two threads calling…
charfeddine.ahmed
  • 526
  • 2
  • 8
  • 16