Thread: Sockets again :)

  1. #1
    Registered User
    Join Date
    Aug 2001
    Posts
    55

    Sockets again :)

    Hi all,

    Can someone confirm something i think i allready got the answer to

    My socket program:
    Its going great. I have tried it on a local network and it works.
    However, the next test was the internet. Here is the scenerio:

    I am at home and connect to the net using a modem. I run the server side of the program here.

    A mate of mine has my client program and is connected to the net with a modem aswell. I send him the ip address i am connected to the internet with. He types it in and cant get a connection haha.

    Now, when i check my internet connection i got to ips.
    The server ip(my provider) and the client(me) ip.

    So my guess.....This will never work unless my program is running on my internet provides server.

    to get it to work i need to use datagram sockets instedof stream sockets. This to enable a "peer to peer" connection and not having the connection running threw a server?

    Ok, hope i am not confusing the hell out of you...

    G'n'R

  2. #2
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,708
    You don't have to use UDP. If all things are set correctly, it should work. What port are you listening to and what address are you bound to? How did you obtain your current IP address? Also, did you test his client program on your own computer to verify that it would work? Personally, I used web-browsers pointed to my loopback to test server code, and this seemed to be a good approach as far as debugging went. You might find that to be suitable too.
    Code:
    #include <cmath>
    #include <complex>
    bool euler_flip(bool value)
    {
        return std::pow
        (
            std::complex<float>(std::exp(1.0)), 
            std::complex<float>(0, 1) 
            * std::complex<float>(std::atan(1.0)
            *(1 << (value + 2)))
        ).real() < 0;
    }

  3. #3
    Registered User
    Join Date
    Aug 2001
    Posts
    55
    Hi,

    Yep i have testet it. I have testet it locally on my computer (running both server and clint from my mashine) and testet on a local network. e.g. connecting my computer to another and running client/server scenerio. It worked with both tests.

    The port is random above 1024, and with the internet test thing i used the ip address the internet connection gives. e.g. there where two (server address, my provider and client address, the one asigned to me). I am running windowws 2000. I tried both of them. My server program connected and binded to (my client address) but myclient side program (at my mates house) coulnt get a connectoin. He was trying to connect to the ip address i sent him, which was the one i had binded to and was listening.

    But anyway....i will figure it out. Good thing i dont need to rewrite the whole thing for dpackets....


    G'n'R

  4. #4
    Registered User
    Join Date
    Aug 2001
    Posts
    55
    Forgot to mention:

    I have also testet locally with my internet connection. that is:

    I connect to the net. Get my client address from there. e.g
    123.234.45.12. I then use that address in my server program.
    It binds sucessfully. I then run my client program and type in that address for the connection. It connects and i can run multiply clients all chatting and talking to each other nicely....

    G'n'R

  5. #5
    Registered User
    Join Date
    Aug 2001
    Posts
    55
    Hi all,

    hehehe.....the program works. It worked all the time. My mate didnt enter ip correctly. duh....But i have tested it with others and its all happening. Cooool......

    Ok...onwards and upwards......

    Cheers
    G'n'R

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Best way to poll sockets?
    By 39ster in forum Networking/Device Communication
    Replies: 3
    Last Post: 07-22-2008, 01:43 PM
  2. Cross platform sockets
    By zacs7 in forum Networking/Device Communication
    Replies: 5
    Last Post: 06-27-2007, 05:16 AM
  3. multiple UDP sockets with select()
    By nkhambal in forum Networking/Device Communication
    Replies: 2
    Last Post: 01-17-2006, 07:36 PM
  4. Raw Sockets and SP2...
    By Devil Panther in forum Networking/Device Communication
    Replies: 11
    Last Post: 08-12-2005, 04:52 AM
  5. Starting window sockets
    By _Cl0wn_ in forum Windows Programming
    Replies: 2
    Last Post: 01-20-2003, 11:49 AM