 |
C++Talk.NET C++ language newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Wenfei Guest
|
Posted: Wed Jul 27, 2005 2:31 pm Post subject: select and send |
|
|
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
|
|
| Back to top |
|
 |
Howard Guest
|
Posted: Wed Jul 27, 2005 2:43 pm Post subject: Re: select and send |
|
|
"Wenfei" <ye_wenfei (AT) hotmail (DOT) com> wrote
| Quote: | 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
|
|
| Back to top |
|
 |
Victor Bazarov Guest
|
Posted: Wed Jul 27, 2005 2:44 pm Post subject: Re: select and send |
|
|
Wenfei wrote:
| Quote: | 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
|
|
| Back to top |
|
 |
Allan Bruce Guest
|
Posted: Wed Jul 27, 2005 2:48 pm Post subject: Re: select and send |
|
|
"Wenfei" <ye_wenfei (AT) hotmail (DOT) com> wrote
| Quote: | 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
|
|
| Back to top |
|
 |
Keith Thompson Guest
|
Posted: Wed Jul 27, 2005 6:33 pm Post subject: Re: select and send |
|
|
"Howard" <alicebt (AT) hotmail (DOT) com> writes:
| Quote: | "Wenfei" <ye_wenfei (AT) hotmail (DOT) com> wrote in message
news:1122474711.932292.230110 (AT) o13g2000cwo (DOT) googlegroups.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) [email]kst-u (AT) mib (DOT) org[/email] <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.
|
|
| Back to top |
|
 |
Maxim Yegorushkin Guest
|
Posted: Thu Jul 28, 2005 7:57 am Post subject: Re: select and send |
|
|
[]
| Quote: | 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>
|
|
| Back to top |
|
 |
Allan Bruce Guest
|
Posted: Thu Jul 28, 2005 8:11 am Post subject: Re: select and send |
|
|
"Maxim Yegorushkin" <maxim.yegorushkin (AT) gmail (DOT) com> wrote
| Quote: | []
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
|
|
| Back to top |
|
 |
Wenfei Guest
|
Posted: Thu Jul 28, 2005 5:29 pm Post subject: Re: select and send |
|
|
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
|
|
| Back to top |
|
 |
Howard Guest
|
Posted: Thu Jul 28, 2005 5:35 pm Post subject: Re: select and send |
|
|
"Wenfei" <ye_wenfei (AT) hotmail (DOT) com> wrote
| Quote: | 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
|
|
| Back to top |
|
 |
Allan Bruce Guest
|
Posted: Thu Jul 28, 2005 6:13 pm Post subject: Re: select and send |
|
|
"Wenfei" <ye_wenfei (AT) hotmail (DOT) com> wrote
| Quote: | 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
|
|
| Back to top |
|
 |
Default User Guest
|
Posted: Thu Jul 28, 2005 8:45 pm Post subject: Re: select and send |
|
|
Wenfei wrote:
| Quote: | 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
|
|
| Back to top |
|
 |
CBFalconer Guest
|
Posted: Thu Jul 28, 2005 10:08 pm Post subject: Re: select and send |
|
|
Wenfei wrote:
| Quote: |
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
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|