|
-
Jul 3rd, 2005, 01:51 PM
#1
Thread Starter
New Member
Winsock behind routerS
I'm relatively new at visual basic but i've lost several nights of sleep working out how it works. I've come across a problem that I can't figure out. I'm making a program with winsock using TCP/IP.
Problem 1: I'm behind a router. here: http://www.vbforums.com/showthread.p...hlight=connect they talk about changing your router settings so that certain ports are forwarded to certain computers. However, I'm making a small chat client for practice and I don't think my friend (half of which are also behind routers) will go for having to change thier router settings. is there another way to do this without changing router settings?
problem 2: it seems my winsock connection will only connect once. for instance, if i'm connected to a computer, then i disconnect (winsock1.close), whenever i try to reconnect, it won't let me. I have to restart both clients in order to connect to it. any guesses as to what i'm doing wrong here?
problem 3: this is really more a nuisance than a problem. is there a way to get past the catch 22 of "you need to connect to send an ip, you need to send an ip to connect" while using a direct connection between two computers who's ip is dynamic?
i'm extreamly thankful for any replies. i've lost 2 nights of sleep on this problem alone and i finally decided to get help.
again, thank you,
daytripper
-
Jul 4th, 2005, 03:19 PM
#2
Lively Member
Re: Winsock behind routerS
This is why IRC (Internet Relay Chat) was created - two people talking directly to each other is generally a troublesome task. Your best bet is to setup a single chat server on your computer, and forward the correct port(s) for it, and have your friends connect to it.
For problem #2, I'm not sure what could be wrong... could you paste some of the code?
#3: Since your IP may be dynamic, take a look at dyndns.org's services, they offer free myname.dyndns.org with a update client that will report your current IP to their DNS servers. Then, you can set your chat client to use this domain name.
-
Jul 5th, 2005, 12:44 AM
#3
Thread Starter
New Member
Re: Winsock behind routerS
sorry for the late reply. thank you for the reply. i can walk a friend through port redirecting, i can get them to connect to me, but the problem is both of those situations involve me. if two others are using it, they might have that knowlege base. but based off of what i've seen in research, it's the only way. i guess i'll just have to work around it. thanks anyway though.
as far as problem 2 goes, i think it's my computer. i've tested it with code that others say have worked for them. it's basically:
sub cmdconnect_click()
winsock1.connect remoteip, remoteport
end sub
sub cmdlisten_click()
winsock1.localport = localport
winsock1.listen
end sub
sub cmdsend_click()
winsock1.datasend text1
end sub
sub winsock1_datarecieved()
winsock1.getdata incoming, vbstring
text2 = text2 & incoming
end sub
sub winsock1_connectionrequest()
if winsock1.state <> 0 then winsock1.close
winsock1.localport = 0
winsock1.accept requestid
end sub
i don't have my program available so i just wrote that from the top of my head but i think that's about the gist of it.
thanks for suggesting that site. it sounds like a good site to keep handy for various reasons.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|