Sign in to follow this  
Followers 0
roy

Tcp Echo Server & Client

9 posts in this topic

Look at the attached zip file.

This is an example of an echo server that accept multiple concurrent client connections and reply to each one the same string received.

Sorry but it is at a very initial level of developing.

To try it do:

1. Start the server program and push the Listen button;

2. Start the client program, connect than enter some text and push Send button.

3. Start another client program , connect than enter some text and push Send button.

4. Look at the server windows.

Server notes: If you push the Pause button, no new connection will be accepted but the current active connection still remain active.

I hope you'll enjoy :( .

Feedback/Comments will be appreciated.

Roy.

TCPEcho.zip

Share this post


Link to post
Share on other sites



Look at the attached zip file.

This is an example of an echo server that accept multiple concurrent client connections and reply to each one the same string received.

Sorry but it is at a very initial level of developing.

To try it do:

1. Start the server program and push the Listen button;

2. Start the client program, connect than enter some text and push Send button.

3. Start another client program , connect than enter some text and push Send button.

4. Look at the server windows.

Server notes: If you push the Pause button, no new connection will be accepted but the current active connection still remain active.

I hope you'll enjoy :) .

Feedback/Comments will be appreciated.

Roy.

<{POST_SNAPBACK}>

Thanks for sharing.

I tried to run the code but these files aren't in the zip file:

windows.h

windowsx.h

string.h

winsock.h

Can someone tell me where I can download these files?


If you learn from It, it's not a mistake

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Look at the attached zip file.

This is an example of an echo server that accept multiple concurrent client connections and reply to each one the same string received.

Sorry but it is at a very initial level of developing.

To try it do:

1. Start the server program and push the Listen button;

2. Start the client program, connect than enter some text and push Send button.

3. Start another client program , connect than enter some text and push Send button.

4. Look at the server windows.

Server notes: If you push the Pause button, no new connection will be accepted but the current active connection still remain active.

I hope you'll enjoy :) .

Feedback/Comments will be appreciated.

Roy.

<{POST_SNAPBACK}>

Has anyone tried to connect through the internet?

Using an Internet public IP address?

I always get this error "An unexpected error occurred (Error 10049)"

When entering a public IP address, such as, 203.X.X.X or 59.X.X.X etc.

I can't seem to get it to accept an internet IP.

Connecting locally on the same LAN works fine.

using 127.0.0.1, 192.X.X.X, or 10.X.X.X

Edited by stalliont

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Has anyone tried to connect through the internet?

Using an Internet public IP address?

I always get this error "An unexpected error occurred (Error 10049)"

When entering a public IP address, such as, 203.X.X.X or 59.X.X.X etc.

I can't seem to get it to accept an internet IP.

Connecting locally on the same LAN works fine.

using 127.0.0.1, 192.X.X.X, or 10.X.X.X

<{POST_SNAPBACK}>

@stalliont:

Did you check the firewall settings?

You seem to be able to run the program.

Are you owning those missing files (the "include files" that is)?

Please let me know.

Cheers, Scriptonize

Edited by Scriptonize

If you learn from It, it's not a mistake

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

@stalliont:

Did you check the firewall settings?

You seem to be able to run the program.

Are you owning those missing files (the "include files" that is)?

Please let me know.

Cheers, Scriptonize

<{POST_SNAPBACK}>

the server wouldn't let me enter public IP address.

Yes running on the LAN works fine. I'm using the lastest Autoit beta, so I don't get any Include, or *.h file not find error.

And I have check my firewall settings to port forward to my internal Address(where server.au3 is run). But the program when u start the server.au3 doesn't allow to enter 203.X.X.X etc.

For example I enter 203.23.167.55 then click "Listen". And get the "An unexpected error occurred (Error 10049)"

To replicate this problem, after entering a public IP address, Click "Listen", then click "Pause", Then click "Listen" again. You get the ERROR MSG.

I assume there is some program coding error. Such as GuiCtrlRead($TxtAddress) not reading properly somewhere in the script. And I can't find where is it, to modify to fix this.

Edited by stalliont

Share this post


Link to post
Share on other sites

the server wouldn't let me enter public IP address.

Yes running on the LAN works fine. I'm using the lastest Autoit beta, so I don't get any Include, or *.h file not find error.

And I have check my firewall settings to port forward to my internal Address(where server.au3 is run). But the program when u start the server.au3 doesn't allow to enter 203.X.X.X etc.

For example I enter 203.23.167.55 then click "Listen". And get the "An unexpected error occurred (Error 10049)"

To replicate this problem, after entering a public IP address, Click "Listen", then click "Pause", Then click "Listen" again. You get the ERROR MSG.

I assume there is some program coding error. Such as GuiCtrlRead($TxtAddress) not reading properly somewhere in the script. And I can't find where is it, to modify to fix this.

<{POST_SNAPBACK}>

Hi Stalliont. There are no errors in the script. This is a normal behavior because your public ip address is out-side of your lan. You cannot listen to this ip.

Put the server program in listen mode on your local ip address and leave the firewall forward your public ip to your local ip and be sure that the port you choose is opened.

In the client machine, wherever in the internet, put your server's Pubblic ip address and connect. Check also the client side firewall, if one present, to open the correct port.

Bye, Roy :)

Share this post


Link to post
Share on other sites

Right... forward your Router/firewall to your local IP with the correct port.. and it will work

Share this post


Link to post
Share on other sites

Hi.

I tried to compile the files with the beta but got the following errors:

Server :

C:\Dokumente und Einstellungen\guido\Eigene Dateien\AutoIT Skripte\TCPEcho\Server.au3(208,11) : ERROR: $wSck already declared as parameter

Dim $wSck,

~~~~~~~~~^

C:\Dokumente und Einstellungen\guido\Eigene Dateien\AutoIT Skripte\TCPEcho\Server.au3(262,13) : ERROR: TCPStartup() [built-in] called with wrong number of args.

TCPStartUp()

~~~~~~~~~~~^

C:\Dokumente und Einstellungen\guido\Eigene Dateien\AutoIT Skripte\TCPEcho\Server.au3(270,16) : ERROR: TCPShutdown() [built-in] called with wrong number of args.

TCPShutDown()

~~~~~~~~~~~~~~~^

C:\Dokumente und Einstellungen\guido\Eigene Dateien\AutoIT Skripte\TCPEcho\Server.au3(313,10) : ERROR: $Str already declared as parameter

Dim $Str

~~~~~~~~^

C:\Dokumente und Einstellungen\guido\Eigene Dateien\AutoIT Skripte\TCPEcho\Server.au3 - 4 error(s), 0 warning(s)

whats this about. i havent read the source yet but i wonder why i cant compile the code as it is because you guys have no probs with it

thx in advance for some hints

Share this post


Link to post
Share on other sites

On my Notebook i've no probs. So i gonna check the version on the other pc.

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