I've written an app in RH7 that creates a socket by in the following way:
However RH6 seems to have an issue with the above code and spits out:Code:int sockDesc = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP); sockaddr_in addr; memset(&addr, 0, sizeof(addr)); // Zero out address structure addr.sin_family = AF_INET; // Internet address
statmars.cpp:84: `IPPROTO_TCP' undeclared (first use this function)
statmars.cpp:86: `sockaddr_in' undeclared (first use this function)
statmars.cpp:86: parse error before `;'
statmars.cpp:87: `addr' undeclared (first use this function)
I've included sys/types.h and sys/socket.h (as well as netdb.h)... Am I missing something that needs to be there for RH6?
interestingly enough, if I output the value of IPPROTO_TCP in RH7, I get 6 - which is protocol number for regular old TCP from /etc/protocols - maybe I should just be using TCP instead of IPPROTO_TCP (I really don't know the difference)?