thanks for the info mk.
Hey my other thread the code is quite long, i have simplified it here wondering if you can have a look, its very basic. I cant work out what the problem is though
i have a function
i pass it two variables makeConnection("127.0.0.1", 3000)
get the error cannot preform socket action on non socket. its really frustrating me now.
Code:
int makeConnection(char *ip, int port){
int s;
struct sockaddr_in connectto;
if(s = socket(AF_INET,SOCK_STREAM,0) == -1)
bail("Socket Error");
memset(&connectto,0,sizeof(connectto));
connectto.sin_family = AF_INET;
connectto.sin_addr.s_addr = inet_addr(ip);
connectto.sin_port = htons(port);
if (connect(s,(struct sockaddr *)&connectto,sizeof(connectto)) < 0)
bail("Connection Error");
//we have connected.
printf("We have connected.\n\n");
}