By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,887 Members | 1,214 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,887 IT Pros & Developers. It's quick & easy.

select and send

P: n/a
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

Jul 27 '05 #1
Share this Question
Share on Google+
11 Replies


P: n/a

"Wenfei" <ye*******@hotmail.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
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
Jul 27 '05 #2

P: n/a
Wenfei wrote:
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
Jul 27 '05 #3

P: n/a

"Wenfei" <ye*******@hotmail.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
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
Jul 27 '05 #4

P: n/a
"Howard" <al*****@hotmail.com> writes:
"Wenfei" <ye*******@hotmail.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
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.


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

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Jul 27 '05 #5

P: n/a
[]
<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>

Jul 28 '05 #6

P: n/a

"Maxim Yegorushkin" <ma***************@gmail.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
[]
<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
Jul 28 '05 #7

P: n/a
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

Jul 28 '05 #8

P: n/a

"Wenfei" <ye*******@hotmail.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
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
Jul 28 '05 #9

P: n/a

"Wenfei" <ye*******@hotmail.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
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
Jul 28 '05 #10

P: n/a
Wenfei wrote:
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
Jul 28 '05 #11

P: n/a
Wenfei wrote:

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?

--
"If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers." - Keith Thompson
Jul 28 '05 #12

This discussion thread is closed

Replies have been disabled for this discussion.