Originariamente inviato da simo_85
Non é la "soluzione" ma puoi arranguare cosi, (in locale)..
codice server
codice:
char *address;
...
echoserver.sin_port = htons(atoi(argv[1]));       /* server port */
address = inet_ntoa(echoserver.sin_addr);
...
printf("%s:%i %s:%i\n", address, ...
Grazie!
La cosa è alquanto strana ma se si vede la descrizione della inet_ntoa() nel man:
The inet_ntoa() function converts the Internet host address in, given in network byte order, to a string in IPv4 dotted-decimal notation. The string is returned in a statically allocated buffer, which subsequent calls will overwrite.
credo che sia dovuta al fatto che il parametro di ritorno è allocato staticamente e sovrascritto, ma non sono sicuro.