Hello folks,
Working on some linux code that has some sockets stuff, trying to port it
to sunos. Dont know nothing about sockets or if this is going to work.
Trying to take Rom into graphics.
The accept and getpeername both look like this,
if (!(getpeername(sock, (struct sockaddr *) &sin, (socklen_t *) &len)))
newsock = accept(sock, (struct sockaddr *) &naddr, (socklen_t *) &len);
the errors produced complain about socklen_t not being declared, my
library has getpeername like this,
int getpeername(int socket, struct sockaddr *address, size_t *address_len);
so I stripped out the socklen_t for both(changing it to size_t causes
errors),
if (!(getpeername(sock, (struct sockaddr *) &sin, &len)))
newsock = accept(sock, (struct sockaddr *) &naddr, &len);
Wrong?
The other problem is with inet_ntoa, looking at rom I see a comment about
it and gcc not being to compatible. Suggestions on fixing this?
if (!(getpeername(sock, (struct sockaddr *) &sin, (socklen_t *) &len)))
{
hp = gethostbyaddr((char*) &sin.sin_addr.s_addr,
sizeof(sin.sin_addr.s_addr), AF_INET);
if (hp != NULL)
(void) strcpy(buf, hp->h_name);
else
strcpy(buf, inet_ntoa(sin.sin_addr));
printf("New connection from host %s\n", buf);
}
Thanks,
Robert Allen