Hi I've tried for a few hours to figure this out - but the solution is escaping me.
This is a snippet of code for a program I am writing in C. iServerListenPort has been previously assigned.
Here is the code that does not work. It crashes after entering the IP address
This code Does workCode:char *serverip; printf("Please enter a IP address of the server you wish to connect to\n"); scanf("%s",&serverip); printf("\nConnecting to %s Port %d\n", serverip, iServerListenPort); if(ClientSocketObject.Connect(serverip , iServerListenPort)) { printf("Client Connected\n"); }
Here is the definition for socketobject.connectCode:char *serverip = "192.168.2.179"; printf("\nConnecting to %s Port %d\n", serverip, iServerListenPort); if(ClientSocketObject.Connect(serverip , iServerListenPort)) { printf("Client Connected\n"); }
Thank-You very much for any help!!Code:bool Connect(char* szServerAddress, int iPort)



LinkBack URL
About LinkBacks



