Jump to content

Recommended Posts

Posted (edited)

Hello, first: I'm "Autoit Watcher/Viewer" i was watching this forum and it's posts with old acc i don't remember it's email/user whatever, i wanna say: "hey Melba23 you really helped most of members here include me and i just wanted to tell you god save you. ^^"


i want to make a little private chat/connection between me and my friends, And control the chat server whether shutting-down it or open it, but the problem ocurrs when i try to recieve the connections.

My question is : The TCPListen() creates a socket to listen to an specific "IP Connection", So do i need to type in each friends' ip to can connect to my chat? Or what should i do to make everyone of them connect to me easly without needing to create single script for every friend to join me.E.g.

;The server script :
Global $ip = "0.0.0.0", $port = 12345
Func ServerSided()
    While 1
        $s_listen = TCPListen($ip, $port) ; Here i want it to Listen to any incoming "IP Connection" from my Friends/Script not listen only from the ip typed ! because i don't want to write new ip everytime their ip changes.
        TCPAccept($s_listen)
        If GUIGetMsg() = $GUI_EVENT_CLOSE Then Return False
        Local $recvDt = TCPRecv($s_listen, 2048) ; recieve data from anyone connected to server. not a specific IP 
        _GUICtrlEdit_InsertText($edit, "msg from: " & $ip & @CRLF & $recvDt)
        TCPCloseSocket($s_listen)
        Sleep(10)
    WEnd ; here the IP/Friend who sent the data. in this script the ip will be same everytime because the client and server are on the same pc.  huhh :S
EndFunc   ;==>ServerSided
;The client script :

$s_connect = TCPConnect($ip, $port) ; here i need friends/clients connect to the "SERVER IP" not their local ip  !! and check whether server online or not


Those were a shorten scripts just to explain my needs,
I hope i explained well what i really need to do
and sorry for my english. ^ ^

any helps would be appreciated.
 

Edited by AhmedV
Posted (edited)

I think this is a good example:

 

 

Edited by mLipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted

As to your script:

$s_connect = TCPConnect($ip, $port) ; here i need friends/clients connect to the "SERVER IP" not their local ip  !! and check whether server online or not

If server IP is not Local IP then the question are:

  1. do you use NAT or you have your own private == not "Local IP" ?
  2. do you have added any exception to your firewall on Router and in your Windows ?

 

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted
  On 5/3/2016 at 9:10 PM, mLipok said:

I think this is a good example:

 

 

Expand  

This isnt what im looking for as it works only on local area  networks and i want my server work online and clients connect to it and send/receive commands to/from clients

  On 5/3/2016 at 9:15 PM, mLipok said:

As to your script:

$s_connect = TCPConnect($ip, $port) ; here i need friends/clients connect to the "SERVER IP" not their local ip  !! and check whether server online or not

If server IP is not Local IP then the question are:

  1. do you use NAT or you have your own private == not "Local IP" ?
  2. do you have added any exception to your firewall on Router and in your Windows ?

 

Expand  

1. What is NAT? My knowledge about IPs and PORTs is not verywell

If you mean about the static ip yes i would get one.

2. Do i need to put exceptions in win FW and router to make it work?

Posted

NAT Network Adress Translation -

For example:
If you have DSL or ADSL connected to your home router, and to this router you have connected few devices then this all devices have adress like 192.168.x.x or 172..... or 10.....

It mean your computer is connected via NAT Router.

 

1. do it or you should add port forwarding to router configuration
2. I think yes

 

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted

Aha i have NAT, my ip address is 192.168.1.x but as you know this is the local ip not the real public IP, but when i get a static ip address my public ip wont change so client script will be set up to the static ip.

And we get back to the main question, how to make the Server accept the clients request and how to send them commands or receive?

Posted

Set port forwarding on your router, and setup exception in firewall on your server machine.

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

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
  • Recently Browsing   0 members

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