Sign in to follow this  
Followers 0
dantay9

TCP on different computers

11 posts in this topic

I am fairly new to TCP functions. I am making a chat room (to learn a bit more about TCP) and I am using Kip's TCP UDF. I am moving along well, but haven't been testing it on two computers as I went along. I decided to test it now, but it won't work. It works fine on the same computer (just change the ip address in client.au3 to the same ip server.au3 is using). But when I tested them on another computer, it wouldn't work.

I know this is a lot of code, but I could really use some help.

There is a login part of the client.au3 code, but you can just comment out "AttemptConnection()" (line 89) and add Global $Username = "Some Text" at the top of the script. The database is working fine right now.

Server.au3

Client.au3


[font="Verdana"] [size="2"]"[/size][/font]Failure is not an option -- it comes packaged with Windows"[font="Verdana"][size="2"] Gecko Web Browser[/size][/font][font="Verdana"][size="2"], [/size][/font][font="Verdana"][size="2"]Yahtzee![/size][/font][font="Verdana"][size="2"], Toolbar Launcher (like RocketDock)[/size][/font][font="Verdana"][size="2"]Internet Blocker, Simple Calculator, Local Weather, Easy GDI+ GUI [/size][/font][font="Verdana"][size="2"]Triangle Solver, TCP File Transfer, [/size][/font][font="Verdana"][size="2"]Valuater's Autoit Wrappers[/size][/font][font="Verdana"][size="3"][size="2"][size="2"]OOP In AutoIt[/size][/size][/size][/font][font="Verdana"][size="2"][size="1"]Using Windows XP SP3, 1GB RAM, AMD Athlon Processor @ 2.1 GHzCheck me out at gadgets.freehostrocket.com[/size][/size][/font]

Share this post


Link to post
Share on other sites



I know this is a lot of code, but please bear with me. It works when I test it on the same computer, but when I put the client and the server on different computers, it doesn't connect. I don't know why this is happening.


[font="Verdana"] [size="2"]"[/size][/font]Failure is not an option -- it comes packaged with Windows"[font="Verdana"][size="2"] Gecko Web Browser[/size][/font][font="Verdana"][size="2"], [/size][/font][font="Verdana"][size="2"]Yahtzee![/size][/font][font="Verdana"][size="2"], Toolbar Launcher (like RocketDock)[/size][/font][font="Verdana"][size="2"]Internet Blocker, Simple Calculator, Local Weather, Easy GDI+ GUI [/size][/font][font="Verdana"][size="2"]Triangle Solver, TCP File Transfer, [/size][/font][font="Verdana"][size="2"]Valuater's Autoit Wrappers[/size][/font][font="Verdana"][size="3"][size="2"][size="2"]OOP In AutoIt[/size][/size][/size][/font][font="Verdana"][size="2"][size="1"]Using Windows XP SP3, 1GB RAM, AMD Athlon Processor @ 2.1 GHzCheck me out at gadgets.freehostrocket.com[/size][/size][/font]

Share this post


Link to post
Share on other sites

Oh boy...

Because you are new to TCP, you haven't submitted enough information. You are not being ignored... but the more experienced users know that we need more environment information. Can you ping to each computer. Are there any firewalls or routers between computers? Did you "MsgBox" the @IPAddress1 on the server to make sure you used the right IP on the client? Really... this may be the tip of the iceberg... but throw us a few cubes?

Lar.


f_mrcleansmalm_77ce002.jpgAutoIt has helped make me wealthy

Share this post


Link to post
Share on other sites

i haven't looked through KIPs UDF in a while so ima bit rusty... and the below info doesn't apply to his UDF and is just the basics of understanding how Autoit TCP works

For TCP... basically this is needed:

-TCP capability (obviously)

-Server IP CORRECT IP!!! needs to be viewable from the internet... now... i have no idea how port forwarding works so can't help there

-Server PORT.. again needs to be correct and depends on the Router

-Client connects to server IP & server PORT

-if TCPconnect is bringing up -1 then make sure TCPSTARTUP () is before it XD i did that the other day and took an hour to figure it out :D

-Multiclient servers use Arrays to store the SOCKETS returned by TCPACCEPT ()... this is more complex than a one on one TCP chat...

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

OK. This doesn't make any sense. First, I used MsgBox to check the server IP. Then I hardcoded that IP into my test program and the server. I pinged the server from the client computer and it returned 0. Then I did TCPStartUp(), TCPConnect(), and TCPShutdown(), and the TCPConnect() returned 424 (which I believe is an error message). The odd thing is my server received a connection because RegisteredEvent_NewClient() was called on the server. What is going on? Here is the test script I used:

$IPAddress = "174.101.217.234"
$Port = 8080

MsgBox(0, "Ping", Ping($IPAddress)) ;returned 0
TCPStartup()
MsgBox(0, "TCP Connect", TCPConnect($IPAddress, $Port)) ;returned 424
TCPShutdown()
Edited by dantay9

[font="Verdana"] [size="2"]"[/size][/font]Failure is not an option -- it comes packaged with Windows"[font="Verdana"][size="2"] Gecko Web Browser[/size][/font][font="Verdana"][size="2"], [/size][/font][font="Verdana"][size="2"]Yahtzee![/size][/font][font="Verdana"][size="2"], Toolbar Launcher (like RocketDock)[/size][/font][font="Verdana"][size="2"]Internet Blocker, Simple Calculator, Local Weather, Easy GDI+ GUI [/size][/font][font="Verdana"][size="2"]Triangle Solver, TCP File Transfer, [/size][/font][font="Verdana"][size="2"]Valuater's Autoit Wrappers[/size][/font][font="Verdana"][size="3"][size="2"][size="2"]OOP In AutoIt[/size][/size][/size][/font][font="Verdana"][size="2"][size="1"]Using Windows XP SP3, 1GB RAM, AMD Athlon Processor @ 2.1 GHzCheck me out at gadgets.freehostrocket.com[/size][/size][/font]

Share this post


Link to post
Share on other sites

424 may be a valid socket identifier. -1 is an error.

Lar.


f_mrcleansmalm_77ce002.jpgAutoIt has helped make me wealthy

Share this post


Link to post
Share on other sites

424 would be the socket connection... now.. its possible that 8080 is a used port? i'm not sure and the IP are you sure it didn't change on you? is it a Dynamic IP or Static?

Share this post


Link to post
Share on other sites

I know the ip isn't changing because I checked the ip before and after the test. It was the same. The port may or may not be used, I don't know. I tried several different port numbers and none of them would work. The thing that I am confused about is why the ping command I used would fail. It doesn't involve a port so that isn't it. The only other thing I could think of is a firewall. I do have Avast firewall (which I disabled during the test). On the client computer, I have ESET (also disabled during the test). Why would ping fail?


[font="Verdana"] [size="2"]"[/size][/font]Failure is not an option -- it comes packaged with Windows"[font="Verdana"][size="2"] Gecko Web Browser[/size][/font][font="Verdana"][size="2"], [/size][/font][font="Verdana"][size="2"]Yahtzee![/size][/font][font="Verdana"][size="2"], Toolbar Launcher (like RocketDock)[/size][/font][font="Verdana"][size="2"]Internet Blocker, Simple Calculator, Local Weather, Easy GDI+ GUI [/size][/font][font="Verdana"][size="2"]Triangle Solver, TCP File Transfer, [/size][/font][font="Verdana"][size="2"]Valuater's Autoit Wrappers[/size][/font][font="Verdana"][size="3"][size="2"][size="2"]OOP In AutoIt[/size][/size][/size][/font][font="Verdana"][size="2"][size="1"]Using Windows XP SP3, 1GB RAM, AMD Athlon Processor @ 2.1 GHzCheck me out at gadgets.freehostrocket.com[/size][/size][/font]

Share this post


Link to post
Share on other sites

I know the ip isn't changing because I checked the ip before and after the test. It was the same. The port may or may not be used, I don't know. I tried several different port numbers and none of them would work. The thing that I am confused about is why the ping command I used would fail. It doesn't involve a port so that isn't it. The only other thing I could think of is a firewall. I do have Avast firewall (which I disabled during the test). On the client computer, I have ESET (also disabled during the test). Why would ping fail?

I have created simple TCP chat script.Try it out and find out the difference with your script

TCPChat.zip


[size="4"][font="Arial Narrow"][font="Garamond"]Attitude is a little thing that makes a big difference[/font][/font][/size][indent][/indent]

Share this post


Link to post
Share on other sites

compare @ERROR with the Helpfile Ping Error messages... see what you can find

Share this post


Link to post
Share on other sites

@Mecrazycoder

I could go through Kip's udf and figure out what the differences are, but I don't think it would be worth it. Kip's udf is very well developed and having a novice change it wouldn't be a very good idea.

I retested the ping command and it returned 0 with an error of 1. Then I ran the chat program by Mecrazycoder and it worked fine. How can TCPConnect() work even though the ping command doesn't work?


[font="Verdana"] [size="2"]"[/size][/font]Failure is not an option -- it comes packaged with Windows"[font="Verdana"][size="2"] Gecko Web Browser[/size][/font][font="Verdana"][size="2"], [/size][/font][font="Verdana"][size="2"]Yahtzee![/size][/font][font="Verdana"][size="2"], Toolbar Launcher (like RocketDock)[/size][/font][font="Verdana"][size="2"]Internet Blocker, Simple Calculator, Local Weather, Easy GDI+ GUI [/size][/font][font="Verdana"][size="2"]Triangle Solver, TCP File Transfer, [/size][/font][font="Verdana"][size="2"]Valuater's Autoit Wrappers[/size][/font][font="Verdana"][size="3"][size="2"][size="2"]OOP In AutoIt[/size][/size][/size][/font][font="Verdana"][size="2"][size="1"]Using Windows XP SP3, 1GB RAM, AMD Athlon Processor @ 2.1 GHzCheck me out at gadgets.freehostrocket.com[/size][/size][/font]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0