Skip to content
Snippets Groups Projects
TcpExample3TerminalLog.txt 2.03 KiB
Invocation instructions:
* run/debug TcpExample3Server.java
* run/debug TcpExample3Client.java

Program responses:

===================================================
run-single:
TcpExample3Server has started...
Server loop 1: TcpExample3Server socket pair showing host name, address, port:
  (( 0:0:0:0:0:0:0:1=0:0:0:0:0:0:0:1, 2317 ), ( 0:0:0:0:0:0:0:1=0:0:0:0:0:0:0:1, 54180 ))
  note HostName matches address if host has no DNS name
Server loop 2: TcpExample3Server socket pair showing host name, address, port:
  (( 0:0:0:0:0:0:0:1=0:0:0:0:0:0:0:1, 2317 ), ( 0:0:0:0:0:0:0:1=0:0:0:0:0:0:0:1, 54181 ))
  note HostName matches address if host has no DNS name
Server loop 3: TcpExample3Server socket pair showing host name, address, port:
  (( 0:0:0:0:0:0:0:1=0:0:0:0:0:0:0:1, 2317 ), ( 0:0:0:0:0:0:0:1=0:0:0:0:0:0:0:1, 54182 ))
  note HostName matches address if host has no DNS name
[etc.]
[kill process to exit]

===================================================
run-single:
TcpExample3Client creating socket...
==================================================
Client loop 1: now we're talking!
The message the server sent was: 'This is response 1 produced by the server.'
TcpExample3Client creating socket...
==================================================
Client loop 2: now we're talking!
The message the server sent was: 'This is response 2 produced by the server.'
TcpExample3Client creating socket...
==================================================
Client loop 3: now we're talking!
The message the server sent was: 'This is response 3 produced by the server.'
TcpExample3Client creating socket...
==================================================
[etc.]
TcpExample3Client exit

You must kill this client process to stop it, each is in an infinite loop.

If first you kill the server process, that will kill the client process
automatically when the connection drops, simply because the client program
is written that way.  Killing the client process first does not stop the
server, which will keep the localhost port locked.  Go ahead and test this.