socket reads garbage

Roger Villemaire villemaire.roger@uqam.ca
Tue Dec 10 07:36:00 GMT 2002


Hi,
    I posted last week a message about ssh client not working anymore after
I upgraded cygwin.
Since it seems I am the only one having this problem I downloaded compiled
and traced ssh
to find that in fact it doesn't read correctly the ID string coming form the
sshd server. The problem
is that after the connection, the read gives garbage. I have here a simple
program which
reproduces this problem

--BEGIN
#include <sys/socket.h>
#include <arpa/inet.h>


int main(int argc,char *args[])
{
  int sock, lus, i;
  struct sockaddr_in serveraddr;
  char chaine[255];

  sock = socket(AF_INET, SOCK_STREAM, 0);
  if (sock < 0)
    printf("error");

  bzero(&serveraddr,sizeof(serveraddr));

  serveraddr.sin_family = AF_INET;
  serveraddr.sin_port = htons(22); /* 22 = sshd port */

/* 192.168.238.1" is a linux machine on my private home network, replace by
something else. */
  inet_aton("192.168.238.1",&serveraddr.sin_addr);

  if (connect(sock,(struct sockaddr *) &serveraddr, sizeof(serveraddr)) >=
0) {
    printf("connected\n");

    lus = read(sock,chaine,255);

    for (i = 0; i < lus; i++)
      printf("%c",chaine[i]);

    printf("\n");
  }
  close(sock);
}
--END

make bidon
will compile the program.

Execution on linux gives
connected
SSH-1.99-OpenSSH_2.5.2p2

execution on cygwin gives
bash-2.05b$ ./bidon.exe
connected
éÑ þu¸ÿ·o

So something really basic must be wrong on my system, but what ?

I deleted and reinstalled cygwin, I redownloaded and reinstalled
cygwin1.3.17-1 but it didn't help.
Enclose cygcheck -svr output
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: cygcheck.txt
URL: <http://cygwin.com/pipermail/cygwin/attachments/20021210/40a38b27/attachment.txt>
-------------- next part --------------
--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


More information about the Cygwin mailing list