Results 1 to 24 of 24

Thread: Resolved: Winsock with 2 ip's (I doubt anyone will know this)

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Jan 2001
    Posts
    574

    Resolved: Winsock with 2 ip's (I doubt anyone will know this)

    Allright I have a computer with 2 ip adreses. One is the internet ip and 1 network card for a network ip. Now when I open a port with winsock on this pc it is always the network port. But I need to open the Internet Ip port. Can I do this??

    And is there a difference. For example has got each of there ip adressen there own port let same 12000 or something?
    Last edited by jacsoft; Aug 15th, 2003 at 04:46 PM.
    Don't Hate Me Cause You Ain't Me

  2. #2
    Hyperactive Member
    Join Date
    Aug 2002
    Posts
    416
    if you open port 5000 for example... it will be able to accept connections from your LAN or INTERNET. so they share the same port.

  3. #3
    Frenzied Member Mike Hildner's Avatar
    Join Date
    Jul 2002
    Location
    Des Moines, NM
    Posts
    1,690
    I'm not sure if the issue is the same I'm facing, but I'll give it a go.

    I'm writing an app that will reside on a machine that (I guess), needs to have two NICs. One is for the local network, the other is for a different network. I don't know much about this, but I guess this machine has two IP addresses.

    I'm thinking of using two Winsock controls. One, tcpServer, accepts multple connections from the local network. The second, tcpClient, sends/receives messages to the outside network. Then, when a response is received, it forwards that response to the appropriate client.

    Reading the help, it says if you use UDP you can specify the network adapter in the Bind() method. But I need TCP.

    Wondering how to go about this. Is it possible to receive data over one NIC and send data on another?

    A network guy told me (and I may not remember this correctly) that he could tell the router to use one NIC if the IP address began with x, then use the other NIC if it began with y. In this case I wouldn't have to worry about anything.

    Does anyone have any insight into this? Any info if greatly appreciated.

    Mike

  4. #4
    The picture isn't missing BuggyProgrammer's Avatar
    Join Date
    Oct 2000
    Location
    Vancouver, Canada
    Posts
    5,217
    your network ip's should be something like 192.168.1.x. you could check using ipconfig in dos in NT, or winipconfig in 98/me.
    Remember, if someone's post was not helpful, you can always rate their post negatively .

  5. #5
    Frenzied Member Spajeoly's Avatar
    Join Date
    Mar 2003
    Location
    Utah
    Posts
    1,068
    There are 3 ranges reserved for private Use.

    10.0.0.0 Through 10.255.255.255
    172.16.0.0 Through 172.16.255.255
    192.168.0.0 Through 192.168.255.255

    It could be any of them depending on how you're set up.

  6. #6

    Thread Starter
    Fanatic Member
    Join Date
    Jan 2001
    Posts
    574
    That's not what I'm asking .

    I now all about ip adresses etc. But I want to know how to open a port on a specifiek ip adress. Cause I've tried on my computer with 2 ip adresses when I opened a port to connect. But I could only connect through the network and not through the internet.

    So does anyone knows how this is possible?
    Don't Hate Me Cause You Ain't Me

  7. #7
    Addicted Member
    Join Date
    Aug 2002
    Location
    Australia
    Posts
    243
    I have no network or anything set up. I do know that a computer trying to connect to you through the internet may not be getting to you because of a firewall, proxy server e.t.c

    Windows XP comes with a built in firewall. I don't know much about this either not having windows XP but there may be some stuff on the help???
    Scott
    **********
    Visit my web page at www.hyphenex.ugtech.net

  8. #8

    Thread Starter
    Fanatic Member
    Join Date
    Jan 2001
    Posts
    574
    I got Windows 98! And now firewall. The only thing that's running on it is Norton Antivirus 2003, Sygate Home Network and ClearMem
    Don't Hate Me Cause You Ain't Me

  9. #9
    Addicted Member
    Join Date
    Aug 2002
    Location
    Australia
    Posts
    243
    If your on the internet now then send me an e-mail at [email protected] or you can add me to your msn list. I will see if I can ping you and we can sort out this thing through the net. Just to eliminate a few problems
    Scott
    **********
    Visit my web page at www.hyphenex.ugtech.net

  10. #10

    Thread Starter
    Fanatic Member
    Join Date
    Jan 2001
    Posts
    574
    Well king scott I'm on ther internet right now but I am not at the computer with the problem. So I will add you when I get home.

    But the problem is that the computer is sharing the internet wich might be the problem. I know that pinging works:xxx.xxx.xxx.xxx if you want to try.

    Do I need to have Vb installed on that server when you want to try cause I have nog and it is only a:

    Amd k6-2 300
    32 mb ram
    2 mb video
    2,1 gb hd
    and a laptop
    Last edited by jacsoft; Aug 15th, 2003 at 08:24 AM.
    Don't Hate Me Cause You Ain't Me

  11. #11
    Addicted Member
    Join Date
    Aug 2002
    Location
    Australia
    Posts
    243
    not that then %0 data loss.

    Well you should have really told that to me in person then posting it on the internet for the world to see. The only way I could think to do it is use the Bind. Never used it before in my life before so you should try to search up some things in Google.

    I think you could use this because it comes up with bind(post as string, IP as string )
    Scott
    **********
    Visit my web page at www.hyphenex.ugtech.net

  12. #12
    KING BODWAD XXI BodwadUK's Avatar
    Join Date
    Aug 2002
    Location
    Nottingham
    Posts
    2,176
    The port is theoretically open to both so

    Winsock 1 (Lan)

    Open on port 120 and connect accross network


    Winsock 2(Interenet) open on port 1023
    connect accoss internet

    Get from winsock two then send though winsock 1 and vice versa.


    If i have one winsock on port 120 then anyone from the internet OR the network can connect to that port
    If you dribble then you are as mad as me

    Lost World Creations Website (XBOX Indie games)
    Lene Marlin

  13. #13
    KING BODWAD XXI BodwadUK's Avatar
    Join Date
    Aug 2002
    Location
    Nottingham
    Posts
    2,176
    You trying to share the internet????
    If you dribble then you are as mad as me

    Lost World Creations Website (XBOX Indie games)
    Lene Marlin

  14. #14

    Thread Starter
    Fanatic Member
    Join Date
    Jan 2001
    Posts
    574
    Originally posted by king_scott_2
    Well you should have really told that to me in person then posting it on the internet for the world to see. [/I] )
    Well I didn't mind, cause who would attack me. This forum is not being used by hackers (as far as I know) and it was only on let's say 2 hours and btw there is nothing to find on my pc and I have an image of my computer so if someone wants to do harm within 30 minutes I got it al back. And btw if you try random ip numbers it will also be possible to come on my computer so..

    Yep I'm sharing the internet .
    I got a hub at home and my computer has got ADSL and a network card and the only thing that computer does is making sure the other 6(!) computers at my place can use the internet.

    Very usefull and cheaper then a router cause I already had that computer lying doing nothing.



    But the problem is when I open on a random winsock a port I can't connect by internet it just doesn't see the internet ip.

    Kinda like what Mike said with to NIC's then you couldn't use a server cause all ports (65500) can be easily get full cause if you use P2p chat programs etc you get for each user a connection and when you got 6 computers on and 2 network cards you get double ports cause on 1 port it must connect to internet and on an other to the network. So you have only got 32000 ports or something and that divided by 6 is 6000 for each computer so I think that's not much especially when you know what I'm doing . I'm am opening ports like crazy!
    Don't Hate Me Cause You Ain't Me

  15. #15
    Addicted Member
    Join Date
    Aug 2002
    Location
    Australia
    Posts
    243
    well we answered your question. If you listen on a port it will be listening on both the internet and the LAN.
    Scott
    **********
    Visit my web page at www.hyphenex.ugtech.net

  16. #16
    KING BODWAD XXI BodwadUK's Avatar
    Join Date
    Aug 2002
    Location
    Nottingham
    Posts
    2,176
    What os are you using???

    cant you download a piece of software that does it for you??
    If you dribble then you are as mad as me

    Lost World Creations Website (XBOX Indie games)
    Lene Marlin

  17. #17
    Addicted Member
    Join Date
    Aug 2002
    Location
    Australia
    Posts
    243
    check out www.pscode.com for whats called a 'proxy server'
    Scott
    **********
    Visit my web page at www.hyphenex.ugtech.net

  18. #18
    Frenzied Member Mike Hildner's Avatar
    Join Date
    Jul 2002
    Location
    Des Moines, NM
    Posts
    1,690
    ok, but how can one open two Winsock controls to send, not listen, using two NICs?

    That is, I need to send info over 192.x.x.x and 170.x.x.x

  19. #19
    Addicted Member
    Join Date
    Aug 2002
    Location
    Australia
    Posts
    243
    you need to have a connection established before you can send on another control.

    For example - You could have one winsock control listening on port 1 for your LAN and one on port 2 for the internet. After the connection has been established you can start sending on both. Sorry if I'm starting to be useless but it's 2:00 and i'm going to bed
    Scott
    **********
    Visit my web page at www.hyphenex.ugtech.net

  20. #20
    Frenzied Member Mike Hildner's Avatar
    Join Date
    Jul 2002
    Location
    Des Moines, NM
    Posts
    1,690
    Not sure if I'm getting this. This is what I need to do:

    A server application listens for client messages on the local network (say 192.x.x.x). When data is received, it must send on another network (170.x.x.x). When the 170.x.x.x address returns a response, the app must forward that to the 192.x.x.x address.

    So, the app waits for a connection on the 192 address, but must initiate on the 170 address.

  21. #21

    Thread Starter
    Fanatic Member
    Join Date
    Jan 2001
    Posts
    574
    Originally posted by king_scott_2
    you need to have a connection established before you can send on another control.

    For example - You could have one winsock control listening on port 1 for your LAN and one on port 2 for the internet. After the connection has been established you can start sending on both. Sorry if I'm starting to be useless but it's 2:00 and i'm going to bed
    Well thanks for now I will make a small app wich will be able to connect en open ports to test it completely. I just got home (it's not as last as at yours, time difference. But I will test it with some other friends cause you are sleeping right now.

    Thanx for the information. And I will let it know what comes out. I know that a proxy server can be used etc, but that's exactly what I don't want and I know I can connect from that computer to another computer (with an internet ip) but I need an other person to connect to me because i have got an internet ip it should be possible.

    I'll let you know.
    Don't Hate Me Cause You Ain't Me

  22. #22
    Hyperactive Member
    Join Date
    Aug 2002
    Posts
    416
    on the computer that your having problem accepting internet connections on..... goto www.whatismyip.com .... and make sure you're attempting to connect to the correct ip.

    also, inet sharing could screw things up for you...... since it may not know which computer to route the connection to...

    you really should use a router. (they're only $40-$60) ... and in ur router config... u can specify exactly what ports to forward to which ips...

  23. #23
    Hyperactive Member
    Join Date
    Aug 2002
    Posts
    416
    someone mentioned "bind" ... ya, that's what you'd wanna use..... but you can't use that in conjuction with the winsock control. ud have to use winsock apis isntead.

    the winsock control uses bind() behind the scenes..... but u dont have any control over the ip it binds to. (but it shouldnt matter anyways)

  24. #24

    Thread Starter
    Fanatic Member
    Join Date
    Jan 2001
    Posts
    574
    This is so stupid!

    I got it working.

    The problem was when I use a server and I am with an other computer behind that server then I can't connect to that server on his internet ip!

    Kinda stupid but after hard searching I found out that some else could connect.

    Sorry for all the inconvenience here and thanx to you all for helping me.

    Jarry
    Don't Hate Me Cause You Ain't Me

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