------- Comment #1 from laurent at guerby dot net 2006-09-18 18:29 ------- Confirmed on gcc version 4.2.0 20060915 (experimental)
$ ./bind_socket_bug Socket bound to: 0.0.0.0: 53558 Connecting to: 127.0.0.2: 53558 Accepted connection from: 127.0.0.2: 36739 With the following patch: --- g-socket.adb.~1~ 2005-11-15 19:44:55.000000000 +0100 +++ g-socket.adb 2006-09-18 20:26:17.000000000 +0200 @@ -357,6 +357,7 @@ Set_Length (Sin'Unchecked_Access, Len); Set_Family (Sin'Unchecked_Access, Families (Address.Family)); + Set_Address (Sin'Unchecked_Access, To_In_Addr (Address.Addr)); Set_Port (Sin'Unchecked_Access, Short_To_Network (C.unsigned_short (Address.Port))); I get what you expect: Socket bound to: 127.0.0.1: 47557 Connecting to: 127.0.0.2: 47557 raised GNAT.SOCKETS.SOCKET_ERROR : [111] Connection refused Do you confirm? -- laurent at guerby dot net changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Ever Confirmed|0 |1 Keywords| |wrong-code Last reconfirmed|0000-00-00 00:00:00 |2006-09-18 18:29:25 date| | Summary|Bind_Socket doesn't bind to |Ada: Bind_Socket doesn't |specified address |bind to specified address http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28716