Results 1 to 14 of 14

Thread: Winsock over Internet

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jan 2005
    Posts
    25

    Winsock over Internet

    Hey, ok so winsock works if i loop back to my self with 127.0.0.1 or if i connect to a server on another computer with it's ip, if the computer is on the same network.
    How do I connect to a computer that's completely independent from mine except that it's connected to the internet, and has my client or my server?
    If I do the same thing just change the 127.0.0.1 to the person's ip address nothing happens at all.

  2. #2
    PowerPoster
    Join Date
    Dec 2003
    Posts
    4,787

    Re: Winsock over Internet

    Quote Originally Posted by Nafto
    Hey, ok so winsock works if i loop back to my self with 127.0.0.1 or if i connect to a server on another computer with it's ip, if the computer is on the same network.
    How do I connect to a computer that's completely independent from mine except that it's connected to the internet, and has my client or my server?
    If I do the same thing just change the 127.0.0.1 to the person's ip address nothing happens at all.
    All you need to do is change the IP, and make sure both the client/server app are using the same port,

    It should work could you show be your connection and listening code? And also the Pc You are aconnecting to, is it behind a router? Or withing another network?

    Pino

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Jan 2005
    Posts
    25

    Re: Winsock over Internet

    I'm using a working code, I am sure of it. I am not by my computer that has it now but I know it works, it worked when I connected to myself, and it worked on another computer at my school on the network. So I had a server and client running on two of my school computers and when I changed the IP it worked.

    I am actually behind a router. I tried doing if with my computer which is connected to my brother's router wirelessly, to my laptop which was right next to me which was using the same wireless connection. I also tried with my wireless connection to my friends computer at his house, and I don't know what connection he has.

  4. #4
    PowerPoster
    Join Date
    Dec 2003
    Posts
    4,787

    Re: Winsock over Internet

    Quote Originally Posted by Nafto
    I'm using a working code, I am sure of it. I am not by my computer that has it now but I know it works, it worked when I connected to myself, and it worked on another computer at my school on the network. So I had a server and client running on two of my school computers and when I changed the IP it worked.

    I am actually behind a router. I tried doing if with my computer which is connected to my brother's router wirelessly, to my laptop which was right next to me which was using the same wireless connection. I also tried with my wireless connection to my friends computer at his house, and I don't know what connection he has.
    What it is, is that you can connect from behind your router but the ip your friend is giving you may be the ip off his/her router its hard to get an ip of a computer behind a router you would have to set up port forwarding on the router, thats if they have a router

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Jan 2005
    Posts
    25

    Re: Winsock over Internet

    You're right, the IP address I got was the same for my computer and for my laptop, which means it was the router's. Thanks, but how do I do this port forwarding to fix it? If possible I'd like to do this from my program somehow, so if I give it to someone who has a router they'll be able to use it too.

  6. #6
    PowerPoster
    Join Date
    Dec 2003
    Posts
    4,787

    Re: Winsock over Internet

    Quote Originally Posted by Nafto
    You're right, the IP address I got was the same for my computer and for my laptop, which means it was the router's. Thanks, but how do I do this port forwarding to fix it? If possible I'd like to do this from my program somehow, so if I give it to someone who has a router they'll be able to use it too.
    as long as one of you doesnt have a router you should be ok, Ie when i'm playing UT2004 with friends i cant host a game because i'm behind a router, but i can connect to any of them because they arnt behind a router and the ip they get is a true reflection of the PC they use (I'm not 100% with IP's and networks but i know the basics)

    To do the port forwarding its dependant on the router itself you may be best going to the routers home page and see if they support it,

    I have tried port forwarding with my router but i've never managed to get it working maybe i'm just doing it wrong though (I have no need for it now anyways)

    Hope that helps

  7. #7

    Thread Starter
    Junior Member
    Join Date
    Jan 2005
    Posts
    25

    Re: Winsock over Internet

    ok i'll go to the website. So if I get a game like counter-strike (which i am actually thinking of) I'm not going to be able to host a game cuz my router... I can't think that there isn't a solution... are you telling me all those big online games, like half the people can't play them correctly?

    [EDIT] I went to the site, and it said absolutely nothing about port forwarding. So what is that really?

    [edit] I don't think that's it. If I have the IP of my computer though, not of my router, should it work as it is? Because I used a msgbox to display winsock1.localip and it gave me an ip not of my router, so I think that's it, but it still doesnt work with other people. I can now connect to myself though, using that ip, not 127.0.0.1
    Last edited by Nafto; Jan 19th, 2005 at 05:51 PM.

  8. #8
    PowerPoster
    Join Date
    Dec 2003
    Posts
    4,787

    Re: Winsock over Internet

    Quote Originally Posted by Nafto
    ok i'll go to the website. So if I get a game like counter-strike (which i am actually thinking of) I'm not going to be able to host a game cuz my router... I can't think that there isn't a solution... are you telling me all those big online games, like half the people can't play them correctly?

    [EDIT] I went to the site, and it said absolutely nothing about port forwarding. So what is that really?

    [edit] I don't think that's it. If I have the IP of my computer though, not of my router, should it work as it is? Because I used a msgbox to display winsock1.localip and it gave me an ip not of my router, so I think that's it, but it still doesnt work with other people. I can now connect to myself though, using that ip, not 127.0.0.1
    No they can play them correctly, if they get there router set up to forward all data on a certain port to a certain Pc 'behind' the router on the network,

    Port forwarding is dependant on the router itself gimme a second and i'll get a link,

    edit cant find the link, I'll get somone to confirm what i have said
    Last edited by Pino; Jan 20th, 2005 at 04:54 AM.

  9. #9

    Thread Starter
    Junior Member
    Join Date
    Jan 2005
    Posts
    25

    Re: Winsock over Internet

    but this port forwarding, is it done through the program? if so then is there a code for each router? it would seem to me like there would be a general code to do this and then it will either work or not work with your router.

  10. #10
    PowerPoster
    Join Date
    Dec 2003
    Posts
    4,787

    Re: Winsock over Internet

    Quote Originally Posted by Nafto
    but this port forwarding, is it done through the program? if so then is there a code for each router? it would seem to me like there would be a general code to do this and then it will either work or not work with your router.
    You can do port forwarding with code, but you would have to install it on the router (I think) which is near to impossible

    when a connection connects to the ip(router) the router doesnt know what to do with it and there is nothing listening on the router you need a way to pass the data to the correct port on the correct PC

  11. #11

    Thread Starter
    Junior Member
    Join Date
    Jan 2005
    Posts
    25

    Re: Winsock over Internet

    Ok. Lets start over and make it simple. So how do I get my client to connect to the server running on my computer if I have a router. Specifically how do I do whatever it is that I need to do, knowing what it is doesn't help me if I can't do it.

  12. #12
    PowerPoster
    Join Date
    Dec 2003
    Posts
    4,787

    Re: Winsock over Internet

    Quote Originally Posted by Nafto
    Ok. Lets start over and make it simple. So how do I get my client to connect to the server running on my computer if I have a router. Specifically how do I do whatever it is that I need to do, knowing what it is doesn't help me if I can't do it.
    Ok basicly if your running a server on your PC behind a router you need to set up the port forwarding, if your router doesnt support this then I dont think there is anything else you can do,

    I've just spoke to someone about this and they say Port forawrding is the only way to run a server, Most routers do support it, could you post your Model Number\Name and i'll try and find some infomation for you

    Hope it helps
    Last edited by Pino; Jan 21st, 2005 at 05:38 PM.

  13. #13
    VBA Nutter visualAd's Avatar
    Join Date
    Apr 2002
    Location
    Ickenham, UK
    Posts
    4,906

    Re: Winsock over Internet

    Your router allows many computers to connect to the Internet through the same IP address. It achieves this by modifying the packets and changing their address accordingly before sending them out on the Internet. Your router will employ some kind of port forwarding otherwise two way communication between the Internet and PC's inside your netowrk will be impossible.

    If your router has a configurable firewall which allows you to control incoming connections then you will most probably be able to set it up to allow incoming connections to a specficied port to be sent to a particular server on your local network. Failing this it may let you enter the IP address of a DMZ server. If you change this to the IP address of your server then all incoming connections will be sent to that PC. If you do this then you must make sure you have a firewall running on it.

    Best thing to do like already said is to post your router model. Port forwarding may also be referred to as the following by the manufacturer.

    • NAT
    • Firewall (imcoming)
    PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2

    | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload

    Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am.

    Random VisualAd: Blog - Latest Post: When the Internet becomes Electricity!!


    Spread happiness and joy. Rate good posts.

  14. #14
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: Winsock over Internet

    Don't use DMZ unless you absolutely have to. The machine will be exposed to the Internet, which is almost unheard-of nowadays. Most routers have advanced settings that allow you to do port forwarding, which is all you need.
    Last edited by dglienna; Jan 25th, 2005 at 01:50 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width