Jump to content

Tcp Echo Server & Client


roy
 Share

Recommended Posts

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

Link to comment
Share on other sites

  • 2 weeks later...

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

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

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

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

Link to comment
Share on other sites

@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
Link to comment
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 :)

Link to comment
Share on other sites

  • 4 weeks later...

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

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...