04-01-2004
recv syscall for socket programming
I have a question regarding the recv syscall.
Suppose I have a client/server and the following exchange of message took place:
Client --> Server using multiple send syscalls one after another immediately:
send "Packet1"
send "Packet2"
send "Packet3"
Server receives in the following order, taking a long time (couple of secs) to process each message received:
recv "Packet1"
-take 2 secs to process "Packet1"
recv "Packet2Packet3"
What throws me off is the second recv call that the server gets after processing the first recv call. The message is the contents of BOTH the packet 2 and packet 3 that the cilent sends.
It seems that recv reads whatever that is in the buffer, and not the sequence that message comes in. Is that true?
What I am planning to have is a server behaivor that is like this:
recv "Packet1"
- 2 sec of processing time
recv "Packet2"
- 2 sec of processing time
recv "Packet3"
- 2 sec of processing time
For example, since 3 messages are sent to the server, the server will have to call 3 recv explicity to get each individual message even though they are all already in the input buffer. Is that possible with recv?
Thanks
10 More Discussions You Might Find Interesting
1. IP Networking
Hey,
I am learning to program a TCP server and managed to get it up and running (I am using Windows 98SE).
I can use the send function to send information to the client and I can use the recv function to ask the user to pass information through, but when I do so it only allows the client to... (1 Reply)
Discussion started by: KrazyGuyPaul
1 Replies
2. Programming
Hello,
I actually try to make client-server program.
I'm using SCO OpenServer Release 5.0.0 and when I try to compile my code (by TELNET) I've got this error :
I'm just using this simple code :
and I get the same error if I use :
If someone can help me,
Thanks (2 Replies)
Discussion started by: soshell
2 Replies
3. IP Networking
my system is a stand alone system... i want to try doing socket porgramming..ihave heard that this is usually done during testing...
how can i do that....? (6 Replies)
Discussion started by: damn_bkb
6 Replies
4. Programming
Hi ,
I'm facing the following problem in socket programming.
My structure is
struct {
int i;
char *str;
}samp;
I'm creating the pointer to this structure and assigning the value to the structure members and send via the socket to the another process.
The receiver process when... (7 Replies)
Discussion started by: arunviswanath
7 Replies
5. Programming
Hi,
Am very new to socket programming.
When we use UDP sockets to communicate between two processess,
will both the client/server socket be able to send/recv ?
meaning can sendto()/ recvfrom() be used on both server and client?
It could be useful even if anybody provide some link on socket... (1 Reply)
Discussion started by: rvan
1 Replies
6. Programming
So I'm making a program that gets the IP Address of an inputed website, then sends the IP Address to an inputed host. This program has no real meaning, but just a learning experiment. So I sucessfully made the program, then I wanted to try out recv(), and it produces some weird output; here is the... (2 Replies)
Discussion started by: Octal
2 Replies
7. IP Networking
Hello Everyone
Iam working on tcp/ip programming.with some time interval server has to send data.client has to close the connection and to open the connection between the time interval.this is the scenario
when iam closing the connection in client side the connection terminates.how to... (1 Reply)
Discussion started by: sureshvaikuntam
1 Replies
8. Programming
Hi,
I wanted to write a socket program in C, where I always want my socket connected to the server. i.e i shouldn't get disconnected once i get the response back from the server. I want to work in the connected mode, instead of disconnect and connect.
Can somebody please kindly provide me a... (3 Replies)
Discussion started by: sudharma
3 Replies
9. UNIX for Advanced & Expert Users
my socket program is not working with larger port numbers like more than 60000 , any reason why ? (4 Replies)
Discussion started by: Gopi Krishna P
4 Replies
10. Programming
Hello to all
I want download a file in osx intel 64 with NASM , I want to use socket syscall
This is part of my code
section .data
command db "GET /test/2.gif HTTP/1.1\r\nHost: 10.1.1.187\r\n\r\n", 0
; url db "http://172.16.207.153/test/2.gif", 0
global main... (1 Reply)
Discussion started by: recher.jack
1 Replies
LEARN ABOUT DEBIAN
net.recv
Net.recv(3kaya) Kaya module reference Net.recv(3kaya)
NAME
Net::recv - Recieve data from a connection.
SYNOPSIS
String recv( NetHandle h, Int maxlen=-1, Int timeout=0 )
ARGUMENTS
h The connection
maxlen The maximum number of bytes to read (or unlimited, if negative). For TLS connections, this is always unlimited. Note that if the
data to be received contains multi-byte characters, care must be taken to avoid ending receiving part-way through a multi-byte character.
timeout The number of seconds to wait without input before timing out. The default is zero. For TLS connections, this parameter is ignored.
DESCRIPTION
Reads up to maxlen bytes from the connection, and times out after timeout seconds.
AUTHORS
Kaya standard library by Edwin Brady, Chris Morris and others (kaya@kayalang.org). For further information see http://kayalang.org/
LICENSE
The Kaya standard library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public
License (version 2.1 or any later version) as published by the Free Software Foundation.
RELATED
Net.NetHandle(3kaya)
Net.accept(3kaya)
Net.connect(3kaya)
Net.microPending(3kaya)
Net.microRecv(3kaya)
Net.pending(3kaya)
Net.recvByte(3kaya)
Net.recvBytes(3kaya)
Net.send(3kaya)
Kaya October 2012 Net.recv(3kaya)