pirx@wedel.hanse.de (Jan Hinnerk Haul) (11/27/90)
I'm at the end of my wits, so methinks I should ask the gurus... Just beginning to play with sockets (wanting to build a multi-machine chat program), I receive core dumps in listen(). The code below is not mine; I changed only some #include directives (ESIX has the network stuff in /usr/include/lan) and inserted one or two printfs. The main() is mine, of course. The code belows cores in listen(). Here it goes: /* SOCKET.C ** ** Written by Steven Grimm (koreth@ebay.sun.com) on 11-26-87 */ /* ** some #include changed foe ESIX Rev D. JHH */ #include <sys/types.h> #include <sys/time.h> #include <lan/net_types.h> #include <lan/socket.h> #include <lan/in.h> #include <lan/inet.h> #include <lan/netdb.h> #include <stdio.h> #include <ctype.h> extern int errno; int serversock(port) int port; { int sock, x; struct sockaddr_in server; sock = socket(AF_INET, SOCK_STREAM, 0); if (sock < 0) return -errno; memset(&server, 0, sizeof(server)); server.sin_family = (short) AF_INET; server.sin_addr.s_addr = (ulong) INADDR_ANY; server.sin_port = (ushort) htons(port); x = bind(sock, &server, sizeof(server)); if (x < 0) { close(sock); return -errno; } printf("socket created: port= %x \n", server.sin_port); listen(sock, 5); /* CODE DUMPS HERE IN listen(3,5) */ return sock; } main() { int Socke; char puffer[1024]; Socke=serversock(0x1234); if (Socke<0) exit (1); exit(0); } sdb points out: Script started on Mon Nov 26 20:25:55 1990 $ cc -g -o sockquestion sockquestion.c -lbsd -lnet -lnsl_s $ sockquestion socket created: port= 3412 Bus error - core dumped $ sdb sockquestion sock_strm.c: No such file or directory 0x43a in listen:No lines in file *t listen(3,5) [sock_strm.c] serversock(port=4660) [sockquestion.c:48] main(1,0x7ffffe94,0x7ffffe9c) [sockquestion.c:60] *q $ script done on Mon Nov 26 20:28:59 1990 Now I'm quite lost. The code of socket.c is reported to work, and a friend of mine with some socket knowledge (he hacked unix-domain sockets into the xenix/286 kernel :-) does not se an error in the above code. Oh well, it's ESIX SysV/386 Rev. D, 386, 8MB RAM, all network daemons up and running (besides sendmail - smail 3.1 suffices for my needs), a 3C503 ethernet board installed (but nothing connected to it) and recocnized by the kernel. So what's going on here? Any help would be appreciated - but please do not send me long mails, I have to pay for them :-( Best regards Jan --> Jan Hinnerk Haul Hinter jedem guten Paradoxon steckt ein Kreter - +49 4103 15427 voice und wenn er noch so kurze Beine hat. DRH
dave@cs.olemiss.edu (David E. Johnson) (12/01/90)
pirx@wedel.hanse.de (Jan Hinnerk Haul) writes: >I'm at the end of my wits, so methinks I should ask the gurus... >Just beginning to play with sockets (wanting to build a multi-machine >chat program), I receive core dumps in listen(). >The code below is not mine; I changed only some #include directives >(ESIX has the network stuff in /usr/include/lan) and inserted one or >two printfs. The main() is mine, of course. >The code belows cores in listen(). Here it goes: ....code deleted.... >Any help would be appreciated - but please do not send me long mails, I >have to pay for them :-( >Best regards >Jan The problem with the socket code you included and ESIX V is that ESIX does not have a true socket library. The listen() call in ESIX is based on t_listen(), not like BSD. Therefore, all BSD software using sockets will _not_ work with ESIX without major changes to the socket calls. The Network programmers manual for ESIX gives the definitions of the socket library calls, but does not explain there function. Your best off to convert the code to use the TLI functions instead of working with their incompatible socket library. BTW, ESIX is working on System V/R4 for production next year. That release will have complete socket implementation. -- David E. Johnson Department of Computer Science ** Title: Systems Programmer The University of Mississippi ** Telephone: (601) 232-7396 336 Weir Hall ** Internet: dave@cs.olemiss.edu