Jump to content
Sign in to follow this  
SOChaos

Okay... TCP Connection

Recommended Posts

SOChaos

Okay, so here's the deal. I've looked at almost every TCP Thread yet, lol. But for some reason, this doesn't work for me.

Say I'm wanting a Game client to connect to a server:

I'm using this:

;Starting the TCP Server now:


; Included Files
; ==============================================
#include <SERVER_INFO.au3>



; Start Server Socket on port 8484 (Default Port)
; ==============================================
TCPStartUp()
$LOGIN_SERVER_SOCKET = TCPListen($LOGIN_SERVER_IP, $LOGIN_SERVER_PORT)
If $LOGIN_SERVER_SOCKET = -1 Then
    MsgBox(0,"Error","Failed to start TCP Server on: " & $LOGIN_SERVER_IP & ":" & $LOGIN_SERVER_PORT)
    Exit
EndIf
; Server Socket now created
; ==============================================

; Waiting for a client to connect
; ==============================================
$LOGIN_CONNECTED_SOCKET = -1

Do
  $LOGIN_CONNECTED_SOCKET = TCPAccept($LOGIN_SERVER_SOCKET)
Until $LOGIN_CONNECTED_SOCKET <> -1

MsgBox(1, "Connected", "New client Connected")

Okay, now here's the thing, After I start the client, this SHOULD show the Message box saying a new client has connected right?

I just started learning AutoIt, because I find it really interesting, so sorry if this is a stupid question, but I just wanted to know if I did something completely wrong.

Edited by SOChaos

Share this post


Link to post
Share on other sites
iceberg

looks like your $LOGIN_SERVER_IP & $LOGIN_SERVER_PORT have not been defined yet.


mouse not found....scroll any mouse to continue.

Share this post


Link to post
Share on other sites
iceberg

after your include statement, try this: (just an example)

$LOGIN_SERVER_IP = "192.1.1.100"

$LOGIN_SERVER_PORT = "1234"

edit: typo

Edited by iceberg

mouse not found....scroll any mouse to continue.

Share this post


Link to post
Share on other sites
SOChaos

I got it already, I had some help lol. But nah, they were Identified in another file which was Server_Info.au3, but thanks for trying.

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  

×