[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
 

Broken pipe?



Hej,

Så er den gal igen. Jeg har programmeret sockets mange gange før og der har aldrig været problemer. Min tanke er at mit problem har noget at gøre med mit nye legetøj, tråde. Jeg håber tråd-eksperterne har nogle ideer.

Jeg har et stykke kode som connecter til en sever og henter data (en wget-agtig webcrawler på et meget tidligt stadie). Det ser ud ca. sådan her:

 fcntl(msocket, F_SETFL, O_NONBLOCK);
 ...
 connect(msocket, (struct sockaddr *)&dest_addr, sizeof(struct sockaddr));

 if( select((msocket+1), NULL, &contime, NULL, &tv) > 0 )
 {
  if( (FD_ISSET(msocket, &contime)) > 0 )
  {
    ... her burde vi være nogenlunde sikre på at der kan skrives til den socket (og at den er connected).
    error = send(msocket, request, strlen(request), 0);
    if( error == -1 )
        perror("SEND FAILED");

----

Mit problem er at send giver mig broken pipes konstant. I alle tidligere client/servere jeg har lavet har broken pipe ikke forekommet ret meget. Her er et eksempel på hvor ekstremt det er:

TRANSFER OK: 8280 bytes from http://www.tdc.dk/
TRANSFER OK: 8280 bytes from http://www.tdc.dk/
SEND FAILED: Broken pipe
SEND FAILED: Broken pipe
TRANSFER OK: 8280 bytes from http://www.tdc.dk/
SEND FAILED: Broken pipe
SEND FAILED: Broken pipe
TRANSFER OK: 8280 bytes from http://www.tdc.dk/
SEND FAILED: Broken pipe
SEND FAILED: Broken pipe
TRANSFER OK: 8280 bytes from http://www.tdc.dk/
SEND FAILED: Broken pipe
SEND FAILED: Broken pipe
TRANSFER OK: 8280 bytes from http://www.tdc.dk/
SEND FAILED: Broken pipe
SEND FAILED: Broken pipe

Som I kan se så kommer der lidt flere broken pipes end der skulle :-)

Jeg har endvidere prøvet at hente på forskellige webservere, ISPs og på det lokale interface. Samme resultat. Jeg har prøvet at droppe mit connect()-timeout trick og lave msocket blocking. Samme resultat.

Jeg kører kun 1 tråd, så det kan ikke være et problem med flere tråde der prøver at bruge samme socket.

Jeg har en global signal handler som jeg plejer at bruge til at fange de få broken pipes der normalt kommer. Måske det er her problemet ligger? Jeg mener dog stadig ikke at der bør komme så mange EPIPE fejl selvom jeg ikke fanger dem?

Nogen ideer?











 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2005-08-10, 20:09 CEST [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] *