This is client side code for a program I am working on. I've followed the examples I am learning from, and get this warning when compiling:
"passing argument 2 of 'connect' from incompatible pointer type"
The program seems to work as I intend,but I prefer to resolve warnings whenever possible, just in case they may cause trouble down the road.
address and port are read from a config file, but I didn't show that code as it didn't seem relevant to the problem.
What might the problem be?Code:int s,z; char *srvr_addr = address; char *srvr_port = port; struct sockaddr_in adr_srvr; int len_inet; s = socket(PF_INET,SOCK_STREAM,IPPROTO_TCP); memset(&adr_srvr,0,sizeof adr_srvr); adr_srvr.sin_family = AF_INET; adr_srvr.sin_port = htons(atoi(srvr_port)); adr_srvr.sin_addr.s_addr = inet_addr(srvr_addr); len_inet = sizeof adr_srvr; z = connect(s,&adr_srvr,len_inet);