Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><code>1. I write client Java File but whether i need to write server java file.</code></p> <p>Yes, you either need to write your own server (if the server should fulfill some unique requirements) or connect to an existing one. The message "connection refused" indicates that no server is running at the port you are trying to connect to.</p> <p><code>2. Can we send request by using ip and port.</code></p> <p>Yes.</p> <p><code>3. Can we use host name.</code></p> <p>Yes. You need either IP or hostname, and the port.</p> <p><code>4. Any echo server name? i need to send message to this server want to know response.</code></p> <p>You can setup an echo server on your machine so that you can first focus on coding your client. There is a <a href="http://en.wikipedia.org/wiki/Echo_Protocol" rel="nofollow">Standard Echo server</a> defined at port 7. Setup depends on your operating system environment - On Ubuntu Linux, I had to install the <code>xinetd</code> package and enable the echo server in <code>/etc/xinetd.d/echo</code>. Then, you can verify if the server is running by using the <code>telnet</code> program:</p> <pre><code>andreas@ubuntu:~$ telnet localhost 7 Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. Hello Hello </code></pre> <p>Using telnet to connect to any port is also a common technique to verify if a server is running and reachable. With the example from your question, you could check with <code>telnet 127.0.0.1 10008</code> whether a server is running on the port you specified - you will get the same <code>connetion refused</code> as from your Java program if no server is available.</p> <p><code>5. I try both server,java and client.java then i got result? is this solution for me.</code></p> <p>Not sure which server and client you are referring to.</p> <hr> <p>Some additional references:</p> <ul> <li><a href="http://docs.oracle.com/javase/tutorial/networking/sockets/index.html" rel="nofollow">All about sockets</a> (also includes "Writing a Client/Server pair")</li> <li><a href="http://homepage.smc.edu/morgan_david/cs75/labs/enable-xinetd-protocols.htm" rel="nofollow">Enabling desired xinetd protocols</a></li> <li><a href="http://docs.oracle.com/javase/tutorial/displayCode.html?code=http://docs.oracle.com/javase/tutorial/networking/sockets/examples/EchoClient.java" rel="nofollow">Java Tutorial: Echo client in Java</a></li> </ul>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload