From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <97075464321328.tru64-unix-managers.marc@archive.invalid> From: "Burt, Andrew D." Date: Thu, 05 Oct 2000 14:10:43 +0000 To: tru64-unix-managers Subject: tcp client problems on tru64 X-MARC-Message: https://marc.info/?l=tru64-unix-managers&m=97075464321328 MIME-Version: 1 Content-Type: multipart/mixed; boundary="------_=_NextPart_000_01C02ED6.118421C8" This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. ------_=_NextPart_000_01C02ED6.118421C8 Content-Type: text/plain; charset="iso-8859-1" Hi - this may not be a Tru64-specific issue, but it is part of an application I'm running exclusively on a number of Tru64 machines. This is a code segment that worked fine yesterday, but today is getting garbage back from the server. The server, on reception of the test string, responds with a 16 byte string ("OK" followed by 14 spaces). This continues to work fine when fed via a telnet session to the port, but when this program is run, as of this morning, it returns garbage. Is there something obvious in the coding here that would screw something up? The only suggestions I've gotten are that I must be conflicting with something else on the stack. Again, if this is not the appropriate forum, I apologize. Andrew David Burt (503)654-6300 x5482 ------_=_NextPart_000_01C02ED6.118421C8 Content-Type: application/octet-stream; name="test6.c" Content-Disposition: attachment; filename="test6.c" #include #include #include #include #include #include #include #define SA struct sockaddr char strf[64] = "0004test0000000006test\r\n"; char back[64]; char casthost[64] = "139.126.48.80"; struct hostent *hp; struct sockaddr_in sin; main () { int s, i; /* stream to server */ if ((s = socket(AF_INET, SOCK_STREAM, 0)) < 0) { perror ("Socket error.\n"); exit (11); } memset (&sin, 0, sizeof(sin)); sin.sin_family=AF_INET; sin.sin_port=htons(6711); inet_pton(AF_INET, casthost, &sin.sin_addr); for (i=0; (connect (s, (struct sockaddr *) &sin, sizeof(sin)) < 0) && (i<7); i++){ if (i==6) { printf("Unable to connect to server. Please make sure you are connected to the network or try again later. \n"); exit (12); } } send (s, strf, strlen(strf), 0); write(1, strf, strlen(strf)); recv(s, back, 16, 0); write(1, back, strlen(back)); close(s); printf("back: \"%s\"\n", back); printf("out string: %s", strf); exit(0); } /* begin functions */ int inet_pton(int family, const char *strptr, void *addrptr) { if (family == AF_INET) { struct in_addr in_val; if (inet_aton(strptr, &in_val)) { memcpy (addrptr, &in_val, sizeof(struct in_addr)); return(1); } return(0); } errno = EAFNOSUPPORT; return (-1); } ------_=_NextPart_000_01C02ED6.118421C8--