[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

Re: [PROGRAMMERING] C++ Socket programmering, client, test af connection



> Du kan jo bruge non-blocking IO men så skal du nok også ud i noget 
> select/poll/epoll for at finde ud af hvornår der kan sendes/modtages.
>

select/poll/epoll er det ikke for serveren?
 Min applikation er klienten, og serveren har jeg ikke styr over. Dog er der 
data, jeg med jævne mellemrum kunne sende til serveren og få et svar på. 
Hvis jeg gør det engang imellem, kan jeg på den måde teste, at min 
connection stadig er til stede, men er der en anden måde? Hvad med?


fcntl(m_sock, F_SETFL, O_NONBLOCK);
int status=recv ( m_sock, buf, MAXRECV, 0 );
if (status==-1) {
  if (errno==EWOULDBLOCK )
       cout<<"connection still valid\n";
  else
       cout<<"connection error\n";
}
fcntl(m_sock, F_SETFL, O_BLOCK);




 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2006-12-01, 02:01 CET [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *