[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] PHP-Novice, PING??



2009/10/5 Robert Larsen <sslug@sslug>

> Peter Makholm wrote:
> > Søren Sørensen <sslug@sslug> writes:
> >
> >>   echo "making socket<br>";
> >>  $socket = socket_create(AF_INET, SOCK_STREAM, 1);
> >>  echo "Trying to connect<br>";
> >>  $result=socket_connect($socket, "127.0.0.1", 22);
> >>  echo "resultat: ".$result;
> >>  echo "<br>reading<br>";
> >>  if (socket_read($socket, 255))
> >>   {
> >>   echo "Got something<br>";
> >>   }
> >
> > Nu kender jeg intet til PHP, men hvis socket_read laver blocking-IO så
> > forsøger den muligvis at læse 255 bytes før den returnerer og så lang
> > er et ssh-banner ikke.
> >
> > Prøv at nøjes med at læse 3 tegn istedet.
> >
> > //Makholm
>
> Er det ikke nok at du har fået forbindelse ?
> Hvis forbindelsen ikke fejler, så har maskinen jo svaret.
>
> Jamen problemet er jo netop at jeg ikke får forbindelse - socket_connect
burde returnere enten TRUE eller FALSE, og det gør den ikke. Det er sikkert
en banal syntaxfejl jeg ikke kan gennemskue.

// Søren


 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2009-11-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] *