select and send

W

Wenfei

Hi,

For socket, I know how to use select and recv, but I don't know how to
use select and send?
Is anybody know?

Thanks,

Wenfei
 
H

Howard

Wenfei said:
Hi,

For socket, I know how to use select and recv, but I don't know how to
use select and send?
Is anybody know?

Thanks,

Wenfei

You need to ask in a newsgroup for your operating system, or for the
compiler or library you're using that provides these functions. They're not
standard C++ functions.

-Howard
 
V

Victor Bazarov

Wenfei said:
For socket, I know how to use select and recv, but I don't know how to
use select and send?
Is anybody know?

I can't speak to comp.lang.c (the rules may have changed since I
frequented it), but in comp.lang.c++ it's off-topic. Try the NG
dedicated to your OS -- network programming is OS-specific.

V
 
A

Allan Bruce

Wenfei said:
Hi,

For socket, I know how to use select and recv, but I don't know how to
use select and send?
Is anybody know?

Thanks,

Wenfei

This is off-topic for this group as this is not defined by the C standard

<OT>
On my system, you do not need to use select() if you want to send() on a
socket, one just merely calls send() with the appropriate parameters set.
</OT>

Allan
 
K

Keith Thompson

Howard said:
You need to ask in a newsgroup for your operating system, or for the
compiler or library you're using that provides these functions. They're not
standard C++ functions.

Nor are the standard C functions. Cross-posting to comp.lang.c and
comp.lang.c++ is rarely a good idea.
 
M

Maxim Yegorushkin

[]
<OT>
On my system, you do not need to use select() if you want to send() on a
socket, one just merely calls send() with the appropriate parameters set.
</OT>

<OT>
And how on your system do you wait for a ready for write event after a
nonblocking send returns you -1 and errno == EAGAIN?
</OT>
 
A

Allan Bruce

Maxim Yegorushkin said:
[]
<OT>
On my system, you do not need to use select() if you want to send() on a
socket, one just merely calls send() with the appropriate parameters set.
</OT>

<OT>
And how on your system do you wait for a ready for write event after a
nonblocking send returns you -1 and errno == EAGAIN?
</OT>

I dont think we should be discussing this but
<OT>
who said I used nonblocking sockets?
</OT>

Allan
 
W

Wenfei

I mean, When use select() and send() to handle multi connections,
should we use listen and accept also, like select and recv?
Which of the follwoing is correct?

1)
....
FD_SET(sockfd, &fdwrite);
listen(sockfd, NET_TCP_MAX_SYN_BACKLOG);
select(...);
connectionfd = accept(sockfd, ...);
FD_SET(connectionFD, &fdwrite);
if (FD_ISSET(connectionfd, &fdwrite))
send;

OR, 2)

FD_SET(sockfd, &fdwrite);
listen(sockfd, NET_TCP_MAX_SYN_BACKLOG);
select(...);
connectionfd = accept(sockfd, ...);
// run through the existing connections to send
for( i = 0; i <= maxFD; i++ )
if ( (FD_ISSET(connectionfd, &fdwrite)) && (i != sockfd) )
send;

OR , 3)
....
FD_SET(sockfd, &fdwrite);
listen(sockfd, NET_TCP_MAX_SYN_BACKLOG);
select(...);
if (FD_ISSET(sockfd, &fdwrite))
send;

OR , 4)
....
FD_SET(sockfd, &fdwrite);
select(...);
if (FD_ISSET(sockfd, &fdwrite))
send;


Thanks,

Wenfei
 
H

Howard

Wenfei said:
I mean, When use select() and send() to handle multi connections,
should we use listen and accept also, like select and recv?
Which of the follwoing is correct?

Please take such questions to a newsgroup where such things are topical.
This newsgroup is for discussing C++ _language_ issues, not OS-specific
issues using C++ programs.

-Howard
 
A

Allan Bruce

Wenfei said:
I mean, When use select() and send() to handle multi connections,
should we use listen and accept also, like select and recv?
Which of the follwoing is correct?

1)
...
FD_SET(sockfd, &fdwrite);
listen(sockfd, NET_TCP_MAX_SYN_BACKLOG);
select(...);
connectionfd = accept(sockfd, ...);
FD_SET(connectionFD, &fdwrite);
if (FD_ISSET(connectionfd, &fdwrite))
send;

OR, 2)

FD_SET(sockfd, &fdwrite);
listen(sockfd, NET_TCP_MAX_SYN_BACKLOG);
select(...);
connectionfd = accept(sockfd, ...);
// run through the existing connections to send
for( i = 0; i <= maxFD; i++ )
if ( (FD_ISSET(connectionfd, &fdwrite)) && (i != sockfd) )
send;

OR , 3)
...
FD_SET(sockfd, &fdwrite);
listen(sockfd, NET_TCP_MAX_SYN_BACKLOG);
select(...);
if (FD_ISSET(sockfd, &fdwrite))
send;

OR , 4)
...
FD_SET(sockfd, &fdwrite);
select(...);
if (FD_ISSET(sockfd, &fdwrite))
send;


Thanks,

Wenfei

This is the whole point of not discussing Off-topic here. My operating
sytem and setup does not require me to use select() for sending at all.

Allan
 
D

Default User

Wenfei said:
I mean, When use select() and send() to handle multi connections,
should we use listen and accept also, like select and recv?
Which of the follwoing is correct?

What part of "this is off-topic" are you having a problem with?




Brian
 
C

CBFalconer

Wenfei said:
I mean, When use select() and send() to handle multi connections,
should we use listen and accept also, like select and recv?
Which of the follwoing is correct?

You have already been told that this is Off-Topic for c.l.c (and
probably c.l.c++ also), and that you should find a newsgroup
dealing with your system. So why are you rudely annoying us by
continuing the thread? Do you go to a motorcycle dealer when you
want a truck?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,431
Messages
2,571,679
Members
48,796
Latest member
Greg L.

Latest Threads

Top