Jump to content

TCP on different computers


dantay9
 Share

Recommended Posts

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

Link to comment
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

Link to comment
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...

Link to comment
Share on other sites

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
Link to comment
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?

Link to comment
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?

Link to comment
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]

Link to comment
Share on other sites

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

Link to comment
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?

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...