Subject: Failure to employ proper diagnostic tools (This message is being sent to all CPSC 360 students) I have received two requests from students for help because they were unable to send and/or receive for "unknown reasons". The primary cause of the reason being unknown is that the student(s) (1) don't use gdb and (2) also don't even bother to turn on and or expand the diagnostic code I have included in the notes :-( When I included this diagnostic print in one fellow's bind socket routine like this: 73 #if 1 74 fprintf(stderr, "Bind - Fam: %d Port: %d IP: %s \n", 75 addr->sin_family, 76 ntohs(addr->sin_port), 77 inet_ntoa(addr->sin_addr)); 78 #endif proj2 ==> udping -S -p 12345 ping interval: 1.00 count: 134217727 port: 12345 size: 12 server: 1 print flag: 1 s = 4 I get output like this: Note that the port is (probably) in the wrong byte order and the IP address which should be 0.0.0.0 is a rather bizarre looking random number and the PF instead of being 2 is 49,288!! Bind - Fam: 49288 Port: 37823 IP: 98.145.4.8 rc = -1 bind failed: Cannot assign requested address am/proj2 ==> Please be sure that you ENABLE ALL reasonable diagnostics (which should go to stderr) BEFORE sending me your tar file. Please be sure that you DISABLE time before turning in your project. ---------------------------------------------- This same sad state of affairs can also be gleaned from gdb as follows: (gdb) b bind_socket Breakpoint 1 at 0x8048fe3: file socklib.c, line 72. (gdb) r -S -p 12345 Starting program: /home/westall/am/proj2/udping -S -p 12345 Reading symbols from shared object read from target memory...done. Loaded system supplied DSO at 0xb7f33000 [Thread debugging using libthread_db enabled] [New Thread -1208953152 (LWP 30501)] ping interval: 1.00 count: 134217727 port: 12345 size: 12 server: 1 print flag: 1 s = 3 [Switching to Thread -1208953152 (LWP 30501)] Breakpoint 1, bind_socket (sock=3, addr=0xbff329a8) at socklib.c:72 72 int rc = 0; (gdb) print /x *addr $1 = {sin_family = 0x29c8, sin_port = 0xbff3, sin_addr = {s_addr = 0x8049162}, sin_zero = { 0xf4, 0xbf, 0x89, 0x0, 0x4, 0x0, 0x0, 0x0}} (gdb)