silly client server question

This is a discussion on silly client server question within the Windows Programming forums, part of the Platform Specific Boards category; hi i don't much know about networking. and im trying to create a simple server and client to exchange text ...

  1. #1
    Android
    Join Date
    Mar 2004
    Location
    Kurunegala Colony, Sri Lanka, Sri Lanka
    Posts
    362

    silly client server question

    hi i don't much know about networking. and im trying to create a simple server and client to exchange text messages using winsock2. they work fine when i run both in the same machine (using ipa "localhost"). but how can i use them to exchange data over the internet? i think my ip address is a regional one, so i guess all other computers on my region has the same ipa. so, if i give my server to a friend and tell him to run it on his computer, would my client program will able to connect to my server at his end with the same ipa? or is there another way to do this? how does progs like yahoo messanger do it?

    thx for any help.
    Some useless programs i've wrote : slprogrammersheaven
    Youtube: http://www.youtube.com/user/geekyzine
    My amature IT Blog: http://everything-geeky.blogspot.com/
    My Flash games: http://flashweed.blogspot.com/

    (and, sorry for my amature english)

  2. #2
    Deathray Engineer MacGyver's Avatar
    Join Date
    Mar 2007
    Posts
    3,211
    The server's IP needs to be known and the client needs to be able to connect to it. In cases of routers, firewalls, etc. you need to have the external IP address of the machine in question that is running the server, and have the proper configuration on any of the aforementioned devices so the client's requests can be forwarded to that machine.

    Larger IM services more than likely have multiple servers, where some direct which other servers need to handle what requests. Depending on how large the system is, it could easily be made up of many servers.

  3. #3
    Android
    Join Date
    Mar 2004
    Location
    Kurunegala Colony, Sri Lanka, Sri Lanka
    Posts
    362
    thx. but,

    >The server's IP needs to be known and the client needs to be able to connect to it.

    i know. my client and server works fine when i use localhost. but the question: if i have a reagional ip, everyone in the region must have the same ip, right? so in this case, is there such a thing as a machine specific ip for a same region? if there is, how can i find it?
    Some useless programs i've wrote : slprogrammersheaven
    Youtube: http://www.youtube.com/user/geekyzine
    My amature IT Blog: http://everything-geeky.blogspot.com/
    My Flash games: http://flashweed.blogspot.com/

    (and, sorry for my amature english)

  4. #4
    Deathray Engineer MacGyver's Avatar
    Join Date
    Mar 2007
    Posts
    3,211
    http://whatismyip.org/

    Try it with whatever you get there. Don't try it from your own computer. Try it from a different computer external to any LAN you may have.

  5. #5
    Android
    Join Date
    Mar 2004
    Location
    Kurunegala Colony, Sri Lanka, Sri Lanka
    Posts
    362
    sorry MacGyver if my question is not clear(my english is bad).
    i know how to find IPs using website like thoes. and when i say a regional ip, im talking about a whole region under one ISP. so everybody in that region have the same IP - the ISP's IP. so i think there are no machine specific IPs. ?
    Some useless programs i've wrote : slprogrammersheaven
    Youtube: http://www.youtube.com/user/geekyzine
    My amature IT Blog: http://everything-geeky.blogspot.com/
    My Flash games: http://flashweed.blogspot.com/

    (and, sorry for my amature english)

  6. #6
    Registered User
    Join Date
    Nov 2007
    Posts
    11
    Quote Originally Posted by geek@02 View Post
    so everybody in that region have the same IP - the ISP's IP. so i think there are no machine specific IPs.
    No,no,no ... your ISP reserves a whole range of addresses e.g. 1.2.3.0-1.2.3.255, but EACH computer in that region (as you call it) has its OWN IP address!! If all PCs would have same address -> they wouldn't be able to communicate!

  7. #7
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,538
    See an IP address as the address of the computer, much like if you send mails through the post, you need to specify an address to the residence (and whom) you want to receive it.
    Of course, routers complicate the whole thing, usually. And firewalls can block the connection attempts. So there's another problem. The Internet has grown to a complicated place.

  8. #8
    Android
    Join Date
    Mar 2004
    Location
    Kurunegala Colony, Sri Lanka, Sri Lanka
    Posts
    362
    thx.

    ok. then how can i find my friends' IP to connect with my server program at his end (without telling him to lookup his IP and e-mail me with it lol)?
    And another problem: i've read somewhere that when u use a dialup connection, everytime you connect to the net u get a different IP. Is that correct? if that so, creating a IM for a dialup connection becomes impossible. (but thoes IM progs do it all the time)?
    Some useless programs i've wrote : slprogrammersheaven
    Youtube: http://www.youtube.com/user/geekyzine
    My amature IT Blog: http://everything-geeky.blogspot.com/
    My Flash games: http://flashweed.blogspot.com/

    (and, sorry for my amature english)

  9. #9
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,538
    Quote Originally Posted by geek@02 View Post
    thx.

    ok. then how can i find my friends' IP to connect with my server program at his end (without telling him to lookup his IP and e-mail me with it lol)?
    Unless your friend has a DNS, you can't.

    And another problem: i've read somewhere that when u use a dialup connection, everytime you connect to the net u get a different IP. Is that correct? if that so, creating a IM for a dialup connection becomes impossible. (but thoes IM progs do it all the time)?
    Not only for dial up. It happens for other types of connections as well, such as DSL. It's up to the operator whether or not you have static or dynamic IP (IP that changes everytime you connect).

  10. #10
    Android
    Join Date
    Mar 2004
    Location
    Kurunegala Colony, Sri Lanka, Sri Lanka
    Posts
    362
    so then how yahoo messanger does it? i only need to install it, and know my friends email addressess, and the program just lets me to send and recieve text messages like magic! ??? what's the machanism here? please explain more. how can i create something like that? (but i only know winsock currently)

    another thing: when i find my IP (using the dialup connection) on http://www.ip-adress.com/ , it always shows the same IP - even when i disconnect and reconnect again. and, for the location of the IP, it shows the city where my ISP is located. ?
    Last edited by geek@02; 12-03-2007 at 04:28 AM.
    Some useless programs i've wrote : slprogrammersheaven
    Youtube: http://www.youtube.com/user/geekyzine
    My amature IT Blog: http://everything-geeky.blogspot.com/
    My Flash games: http://flashweed.blogspot.com/

    (and, sorry for my amature english)

  11. #11
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,538
    They use a server-approach. Your friend logs into the server, the server stores the IP and notifies your client that your friend is online (or in some similar way).
    So when you want to talk to your friend, it either goes through the server or the server gives out the IP to your friend.
    Another idea is to use a DNS. A DNS is static address in the form of a name (for example google.com is a DNS name). You can always lookup the DNS names and get the correct IP from it, but then you have to set up a DNS service. There are free alternatives that does this, though. Note that your friend must have it and you must have your friend's DNS. After that you can connect at will so long as your friend is online.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Unicode vurses Non Unicode client server application with winsock2 query?
    By dp_76 in forum Networking/Device Communication
    Replies: 0
    Last Post: 05-16-2005, 07:26 AM
  2. Small Client Question
    By Stack Overflow in forum Networking/Device Communication
    Replies: 2
    Last Post: 02-01-2005, 02:26 PM
  3. best download site
    By gooddevil in forum A Brief History of Cprogramming.com
    Replies: 2
    Last Post: 05-20-2004, 10:36 PM
  4. Server Client Messaging Program
    By X PaYnE X in forum Networking/Device Communication
    Replies: 3
    Last Post: 01-04-2004, 04:20 PM
  5. [SOCKETS] Solaris server in C, NT client in VB
    By Daveg27 in forum C Programming
    Replies: 3
    Last Post: 05-23-2002, 10:02 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21