dantay9 Posted September 20, 2009 Share Posted September 20, 2009 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.au3Client.au3 Link to comment Share on other sites More sharing options...
dantay9 Posted September 21, 2009 Author Share Posted September 21, 2009 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. Link to comment Share on other sites More sharing options...
LarryDalooza Posted September 21, 2009 Share Posted September 21, 2009 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. AutoIt has helped make me wealthy Link to comment Share on other sites More sharing options...
CodyBarrett Posted September 22, 2009 Share Posted September 22, 2009 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 -Multiclient servers use Arrays to store the SOCKETS returned by TCPACCEPT ()... this is more complex than a one on one TCP chat... [size="1"][font="Tahoma"][COMPLETED]-----[FAILED]-----[ONGOING]VolumeControl|Binary Converter|CPU Usage| Mouse Wrap |WinHide|Word Scrammbler|LOCKER|SCREEN FREEZE|Decisions Decisions|Version UDF|Recast Desktop Mask|TCP Multiclient EXAMPLE|BTCP|LANCR|UDP serverless|AIOCR|OECR|Recast Messenger|AU3C|Tik-Tak-Toe|Snakes & Ladders|BattleShips|TRON|SNAKE_____________________[u]I love the Helpfile it is my best friend.[/u][/font][/size] Link to comment Share on other sites More sharing options...
dantay9 Posted September 22, 2009 Author Share Posted September 22, 2009 (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 September 22, 2009 by dantay9 Link to comment Share on other sites More sharing options...
LarryDalooza Posted September 22, 2009 Share Posted September 22, 2009 424 may be a valid socket identifier. -1 is an error. Lar. AutoIt has helped make me wealthy Link to comment Share on other sites More sharing options...
CodyBarrett Posted September 22, 2009 Share Posted September 22, 2009 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? [size="1"][font="Tahoma"][COMPLETED]-----[FAILED]-----[ONGOING]VolumeControl|Binary Converter|CPU Usage| Mouse Wrap |WinHide|Word Scrammbler|LOCKER|SCREEN FREEZE|Decisions Decisions|Version UDF|Recast Desktop Mask|TCP Multiclient EXAMPLE|BTCP|LANCR|UDP serverless|AIOCR|OECR|Recast Messenger|AU3C|Tik-Tak-Toe|Snakes & Ladders|BattleShips|TRON|SNAKE_____________________[u]I love the Helpfile it is my best friend.[/u][/font][/size] Link to comment Share on other sites More sharing options...
dantay9 Posted September 22, 2009 Author Share Posted September 22, 2009 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? Link to comment Share on other sites More sharing options...
Mecrazycoder Posted September 22, 2009 Share Posted September 22, 2009 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 scriptTCPChat.zip [size="4"][font="Arial Narrow"][font="Garamond"]Attitude is a little thing that makes a big difference[/font][/font][/size][indent][/indent] Link to comment Share on other sites More sharing options...
CodyBarrett Posted September 22, 2009 Share Posted September 22, 2009 compare @ERROR with the Helpfile Ping Error messages... see what you can find [size="1"][font="Tahoma"][COMPLETED]-----[FAILED]-----[ONGOING]VolumeControl|Binary Converter|CPU Usage| Mouse Wrap |WinHide|Word Scrammbler|LOCKER|SCREEN FREEZE|Decisions Decisions|Version UDF|Recast Desktop Mask|TCP Multiclient EXAMPLE|BTCP|LANCR|UDP serverless|AIOCR|OECR|Recast Messenger|AU3C|Tik-Tak-Toe|Snakes & Ladders|BattleShips|TRON|SNAKE_____________________[u]I love the Helpfile it is my best friend.[/u][/font][/size] Link to comment Share on other sites More sharing options...
dantay9 Posted September 22, 2009 Author Share Posted September 22, 2009 @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? Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now