Article View: borland.public.jbuilder.java.language
Article #7546Re: Running socket code in the jbuilder
From: Nabin Thomas
Date: Tue, 05 Jun 2001 16:04
Date: Tue, 05 Jun 2001 16:04
89 lines
3553 bytes
3553 bytes
Try giving a different port number. Also check if there is any program like
personal firewalls installed which may interfere with server bindings. Also
try connecting to server with telnet
use the command
telnet wt 3283
to connect to the server that you have given.
Russell wrote:
>
> Hi all , i am using RedHat6.1 , jdk1.3 and jbuilder3.5.
>
>
> I cannot connect to KnockClient using Socket() , everything it give me
> the error = "java.net.ConnectExeption : Connection Refused"
>
> Anybody have any ideas ? Below is the KnockClient code :
>
>
> package chatprog;
>
> import java.io.*;
> import java.net.*;
>
> public class KnockClient {
> public static void main(String[] args) throws IOException {
>
> Socket kkSocket = null;
> PrintWriter out = null;
> BufferedReader in = null;
>
> try {
> kkSocket = new Socket("wt", 3283);
> out = new PrintWriter(kkSocket.getOutputStream(), true);
> in = new BufferedReader(new
> InputStreamReader(kkSocket.getInputStream()));
> } catch (UnknownHostException e) {
> System.err.println("Don't know about host: taranis.");
> System.exit(1);
> } catch (IOException e) {
> System.out.println(e.toString());
> System.err.println("Couldn't get I/O for the connection to:
> taranis.");
> System.exit(1);
> }
>
> BufferedReader stdIn = new BufferedReader(new
> InputStreamReader(System.in));
> String fromServer;
> String fromUser;
>
> while ((fromServer = in.readLine()) != null) {
> System.out.println("Server: " + fromServer);
> if (fromServer.equals("Bye."))
> break;
>
> fromUser = stdIn.readLine();
> if (fromUser != null) {
> System.out.println("Client: " + fromUser);
> out.println(fromUser);
> }
> }
>
> out.close();
> in.close();
> stdIn.close();
> kkSocket.close();
> }
> }
--
***********************************
***************************************************
******************* Web Card **********************
***************************************************
Name : Nabin Thomas
e-mail : nabinthomas@hotmail.com
Web : http://nabin.topcities.com
Feel free to contact me thru e-mail or MSN Mssenger
if required but DONOT SPAM
***************************************************
***********************************
Technical Details
Message-ID:
<3B1D0319.85FD4E51@hotmail.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!nntp-relay.ihug.net!ihug.co.nz!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.wirehub.nl!PeerFeed.KWeb.on.ca!dnewsReferences:
<3B1B1D07.A7418BDB@cesmainternational.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f74b3,334e51a05bea46e0 X-Google-Attributes: gidf74b3,public X-Google-ArrivalTime: 2001-06-05 10:29:12 PST Message-ID: <3B1D0319.85FD4E51@hotmail.com> Date: Tue, 05 Jun 2001 21:34:42 +0530 From: Nabin Thomas <nabinthomas@hotmail.com> X-Mailer: Mozilla 4.75 [en] (Win98; U) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: borland.public.jbuilder.java.language Subject: Re: Running socket code in the jbuilder References: <3B1B1D07.A7418BDB@cesmainternational.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 202.9.186.164 X-Trace: dnews 991760918 202.9.186.164 (5 Jun 2001 10:08:38 -0700) Lines: 92 Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!nntp-relay.ihug.net!ihug.co.nz!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.wirehub.nl!PeerFeed.KWeb.on.ca!dnews