Date: Mon, 15 May 2000 18:26:35 +0200 From: Alexander Langer <alex@big.endian.de> To: Barney Wolff <barney@databus.com> Cc: freebsd-net@FreeBSD.ORG Subject: Re: socket programming Message-ID: <20000515182635.A408@cichlids.cichlids.com> In-Reply-To: <3920178a0.244e@databus.databus.com>; from barney@databus.com on Mon, May 15, 2000 at 11:27:00AM -0400 References: <3920178a0.244e@databus.databus.com>
next in thread | previous in thread | raw e-mail | index | archive | help
--17pEHd4RhPHOinZp Content-Type: text/plain; charset=us-ascii Thus spake Barney Wolff (barney@databus.com): > Sigh. Quoting RFC 857: Either you are right and all telnet-clients I can use atm (Linux, Windows9x, FreeBSD) have implemented things wrong or maybe you are wrong. If you are right, I suggest you rewrite things and shout at the guys that they have implemented the protocol wrongly and send them patches. In this case, I was also right, since I said the things have the same effect (on clients _I_ know, also, if this violates the RfC). I suggest trying out the attached source, with and without commented out the handshake and see, what happens. In your opinion this should have no effect since DONT ECHO doesn't mean that. Thanks Alex -- I need a new ~/.sig. --17pEHd4RhPHOinZp Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="localecho.c" #include <sys/types.h> #include <sys/socket.h> #include <stdio.h> #include <netinet/in.h> int main(int argc, char **argv) { int listenfd, sockfd; struct sockaddr_in servaddr, cliaddr; int on, clilen; char buf[10]; if ((listenfd = socket(AF_INET, SOCK_STREAM, 0)) == -1) exit(1); on = 1; if (setsockopt(listenfd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(int)) == -1) exit(1); bzero(&servaddr, sizeof(servaddr)); servaddr.sin_family = AF_INET; servaddr.sin_addr.s_addr = htonl(INADDR_ANY); servaddr.sin_port = htons(12345); if (bind(listenfd, (struct sockaddr *) & servaddr, sizeof(servaddr)) == -1) exit(1); if (listen(listenfd, 2) == -1) exit(1); clilen = sizeof(cliaddr); sockfd = accept(listenfd, (struct sockaddr *) & cliaddr, &clilen); write(sockfd, "\377\373\1\0", 4); for (;;) { printf("Received %i bytes...\n", read(sockfd, buf, 9)); } /* forever */ return (0); } --17pEHd4RhPHOinZp-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-net" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20000515182635.A408>