Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void setupStreams() throws IOException{
- input = new ObjectInputStream(connection.getInputStream());
- }
- private void whileChatting() throws IOException{
- do{
- try{
- if (connection.isClosed()) break;
- Object inputData = new Object();
- inputData = input.readObject();
- //input.reset();
- Message por = new Message();
- por = (Message) inputData;
- sendMessage(por);
- }catch(ClassNotFoundException classNotFoundException){
- //closeCrap();
- }
- }while(true);
- }
- private void sendMessage(Poruka message) throws IOException{
- int var = Server.kontrolni2; // variable which checks to which stream to send message
- output = new ObjectOutputStream(Server.ClientSockets.get(var - 1).getOutputStream());
- try{
- output.writeObject(message);
- output.flush();
- }catch(IOException ioException){
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement