Thread: IP Address

Results 1 to 5 of 5
  1. #1
    258456's Avatar
    Join Date
    May 2010
    Gender
    male
    Location
    ghjghj
    Posts
    1,222
    Reputation
    18
    Thanks
    300
    My Mood
    Relaxed

    IP Address

    My winsock client that i gave to somebody on another LAN network won't work. I know it is a problem with the ip address. I tried to connect using my global ip, but it didn't work, and then i gave him the client that connects with the local ip and it still didn't work. Here is the conflicting (especially look at the sockaddr_in structure) code:


    Code:
    int SendFullScoreReport(char* buffer)
    {
        	WSAData wsa;
    	SOCKET sock;
    
    	if(WSAStartup(MAKEWORD(2,2), &wsa) != 0)
    	{
    		cout<<"An error has occured trying to initialize WinSock.";
    		WSACleanup();
    		cin.get();
    		return 0;
    	}
    
    	sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
    
    	if(sock == INVALID_SOCKET)
    	{
    		cout<<"Socket is invalid.";
    		WSACleanup();
    		cin.get();
    		return 0;
    	}
    
    	struct hostent *host;
    	if((host=gethostbyname("localhost"))==NULL)
    	{
    		std::cout<<"Failed to resolve hostname.\r\n";
    		WSACleanup();
    		system("PAUSE");
    		return 0;
    	}
    
    	SOCKADDR_IN sockaddr;
    
    	sockaddr.sin_family = AF_INET;
    	sockaddr.sin_port = htons(8888);
    	sockaddr.sin_addr.S_un.S_addr = inet_addr("xx.xx.xx.47");
    
    	if(connect(sock, (SOCKADDR*) &sockaddr, sizeof(sockaddr)) != 0)
    	{
    		cout<<"Failed to connect to server.";
    		WSACleanup();
    		cin.get();
    		return 0;
    	}
    	
    	cout<<"\nSending the full score report.";
    	
    	send(sock, "Print", 5, 0);
        
        Sleep(1000);
        
        send(sock, buffer, strlen(buffer), 0);
        
        cout<<"\nThe Full Score Report has been successfully sent.\n";
        
        
        
        closesocket(sock);
        WSACleanup();
        system("PAUSE");
        return 0;
    }

    Ooops, I forgot to mention that I already did port forwarding, and it still didn't work.
    Last edited by 258456; 08-02-2011 at 06:49 PM.

  2. #2
    258456's Avatar
    Join Date
    May 2010
    Gender
    male
    Location
    ghjghj
    Posts
    1,222
    Reputation
    18
    Thanks
    300
    My Mood
    Relaxed
    I am in kind of a hurry because it is for church in 2 days and i want to surprise them. Thanks in advance.

  3. #3
    freedompeace's Avatar
    Join Date
    Jul 2010
    Gender
    female
    Posts
    3,033
    Reputation
    340
    Thanks
    2,792
    My Mood
    Sad
    Less than 2 hours between your first post and second. Please keep in mind that we aren't being paid by anyone to post here, or even help, for that matter.

    Code:
    inet_addr("xx.xx.xx.47");
    must be a valid IP address.

    Though not pretty, the above code works and is completely functional. I have just compiled it and tested it with my own TCP server, and I don't see any issues with the compiled application.

  4. The Following User Says Thank You to freedompeace For This Useful Post:

    258456 (08-03-2011)

  5. #4
    258456's Avatar
    Join Date
    May 2010
    Gender
    male
    Location
    ghjghj
    Posts
    1,222
    Reputation
    18
    Thanks
    300
    My Mood
    Relaxed
    Quote Originally Posted by freedompeace View Post
    Less than 2 hours between your first post and second. Please keep in mind that we aren't being paid by anyone to post here, or even help, for that matter.

    Code:
    inet_addr("xx.xx.xx.47");
    must be a valid IP address.

    Though not pretty, the above code works and is completely functional. I have just compiled it and tested it with my own TCP server, and I don't see any issues with the compiled application.
    First of all, I really appreciate that you replied so quickly, and I understand that you guys aren't getting anything out of helping me so I really appreciate that you answered despite my rudeness.

    Second of all, I know that the code is functional, but nobody can use it outside of my network. That's the issue I have been having for a while. I don't know why it isn't working even though i port forwarded.

    I typed my gateway address in the url box of my browser and it took me to my router settings. I have a 2wire router. I clicked on firewall and then clicked on settings and then made a new user defined application. When it asked me for what port it will connect on i set it to "8888 to: 8888" and then connection timeout i set it for 8400. Then i set the type as "IRC" and then all the other kinds. Is there any reason why it wouldn't work?


    EDIT:===============================

    Ok, I got it to work with my global ip. It wasn't working before. The only problem is that i sent it to a friend and he opened and it didn't connect. Why would that happen? Any ideas?
    Last edited by 258456; 08-03-2011 at 01:28 PM.

  6. #5
    258456's Avatar
    Join Date
    May 2010
    Gender
    male
    Location
    ghjghj
    Posts
    1,222
    Reputation
    18
    Thanks
    300
    My Mood
    Relaxed
    nvrmind, prob solved. it was a port forwarding problem

Similar Threads

  1. X-hair Address
    By Fortran in forum WarRock - International Hacks
    Replies: 25
    Last Post: 12-14-2006, 06:23 PM
  2. Updated addresses for some hacks.
    By sp0tie in forum Gunz Hacks
    Replies: 3
    Last Post: 02-22-2006, 08:18 AM
  3. Replies: 3
    Last Post: 01-04-2006, 09:52 PM
  4. Direct Memory Access (DMA) to Static Memory Addresses
    By Dave84311 in forum Game Hacking Tutorials
    Replies: 0
    Last Post: 12-31-2005, 08:18 PM