• (4 Pages)
  • +
  • « First
  • 2
  • 3
  • 4

A simple Chat program with Client/Server (GUI optional) Rate Topic: ***** 5 Votes

#46 TannerS  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 22-July 15

Posted 22 July 2015 - 02:41 AM

View Postrealmadrid_lover, on 19 December 2014 - 07:14 AM, said:

thanks for your code @pbl! it works fine on my machine, but I got a few questions!
is the start() method in the client side stating " public boolean start()" different with the start method which starts a thread?


public boolean start(){
.
.
.
  new ListenFromServer().start();

}



why did you used objectInputStream instead of inputStream?

it seems that you created a thread in the client to listen to the server for inputs, but you didn't do this for sending the output! if "yes", then why?

sorry for my english!



I am not 100% sure, but I believe the start method is different, since the start method for a thread is public void start() which is not the same. ALso note that Thread .start() calls the overwritten .run method in a class which this one does not have

and I think objectInputStream is used instead of InputStream since InputStream is an abstract class which you can't initialize.

my 2 sents
Was This Post Helpful? 0
  • +
  • -

#47 TannerS  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 22-July 15

Posted 22 July 2015 - 03:05 AM

View PostArkar, on 10 May 2013 - 09:55 PM, said:

Welcome to the Chat room
Connection accepted /149.171.37.231:80
Exception creating new Input/output Streams: java.io.EOFException
Connection accepted /149.171.37.231:80
Exception creating new Input/output Streams: java.io.EOFException
Connection accepted /149.171.37.231:80
Exception creating new Input/output Streams: java.io.EOFException



Hi,
would you please explain why this massage is popped out while trying to connect to the particular server running in "C".

what sort of necessary steps do I need to implement to be able to connect with that server?

Thanks!

found a fix for this yet?
Was This Post Helpful? 0
  • +
  • -

#48 TannerS  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 22-July 15

Posted 22 July 2015 - 04:52 AM

View Postkfirfer, on 22 July 2015 - 02:36 AM, said:

I have allready made this chat in JavaFX
Go to :
https://github.com/kfirfer
And look out "Global-Chat"

The server package is in swing(the same)
And the client package is in javafx.

Is it ok to ask you to explain some of your FXML code?
Was This Post Helpful? 0
  • +
  • -

#49 kfirfer  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 4
  • Joined: 02-February 15

Posted 22 July 2015 - 05:23 AM

View PostTannerS, on 22 July 2015 - 04:52 AM, said:

View Postkfirfer, on 22 July 2015 - 02:36 AM, said:

I have allready made this chat in JavaFX
Go to :
https://github.com/kfirfer
And look out "Global-Chat"

The server package is in swing(the same)
And the client package is in javafx.

Is it ok to ask you to explain some of your FXML code?

FXML has done with SceneBuilder 2.
Was This Post Helpful? 0
  • +
  • -

#50 TannerS  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 22-July 15

Posted 22 July 2015 - 01:40 PM

View Postkfirfer, on 22 July 2015 - 05:23 AM, said:

View PostTannerS, on 22 July 2015 - 04:52 AM, said:

View Postkfirfer, on 22 July 2015 - 02:36 AM, said:

I have allready made this chat in JavaFX
Go to :
https://github.com/kfirfer
And look out "Global-Chat"

The server package is in swing(the same)
And the client package is in javafx.

Is it ok to ask you to explain some of your FXML code?

FXML has done with SceneBuilder 2.


well my only two main question where, (client side)

1) you have Main which is where your main method is at. your main contains a object of LoginController. then you got inside of LoginController you got a object of Main. So in other words, it is kinda like a circle. you have class A has class B, and class B has class A. you did that so you can have access to the stage?

second question was, you only one extra thread receiving info from server. As in his example he does a few threads. Is this becuase you don't need a separate thread to send info out since the gui itself does that and the gui itself runs on its own thread?
Was This Post Helpful? 0
  • +
  • -

#51 kfirfer  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 4
  • Joined: 02-February 15

Posted 25 July 2015 - 06:58 AM

View PostTannerS, on 22 July 2015 - 01:40 PM, said:

View Postkfirfer, on 22 July 2015 - 05:23 AM, said:

View PostTannerS, on 22 July 2015 - 04:52 AM, said:

View Postkfirfer, on 22 July 2015 - 02:36 AM, said:

I have allready made this chat in JavaFX
Go to :
https://github.com/kfirfer
And look out "Global-Chat"

The server package is in swing(the same)
And the client package is in javafx.

Is it ok to ask you to explain some of your FXML code?

FXML has done with SceneBuilder 2.


well my only two main question where, (client side)

1) you have Main which is where your main method is at. your main contains a object of LoginController. then you got inside of LoginController you got a object of Main. So in other words, it is kinda like a circle. you have class A has class B, and class B has class A. you did that so you can have access to the stage?

second question was, you only one extra thread receiving info from server. As in his example he does a few threads. Is this becuase you don't need a separate thread to send info out since the gui itself does that and the gui itself runs on its own thread?

My Main class is the switching views(windows) so, yes Main have both LoginController and LoggedController (2 windows).
and both classes have main object to get access when ever they need.
JavaFX UI have its own thread, and you can communicate and make changes from other threads with jobs queue, you can call it with this code:
Platform.runLater(() -> {
codes modify FX components..
});
Was This Post Helpful? 0
  • +
  • -

  • (4 Pages)
  • +
  • « First
  • 2
  • 3
  • 4