Package messages

Examples of messages.ServiceObject


   
    public boolean connect(String server, int port, String nickName) {
        try {
            clientSocket = new Socket(server, port);
            outStream = new ObjectOutputStream(clientSocket.getOutputStream());
            outStream.writeObject(new ServiceObject(nickName, ServiceTags.ClientLoggedIn));
            new Receive(clientSocket, atmcModel);
        } catch (UnknownHostException ex) {
            atmcModel.setStatus("Connection Error: Unknown Host: "+server+":"+port);
            outStream = null;
            disconnect();
View Full Code Here


            Logger.getLogger(Connection.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    public void sendChatMessage(String message, String to) {
        ServiceObject sout = new ServiceObject("name", ServiceTags.chatMessage);
        sout.setValue(message);
        sendObject(sout);
    }
View Full Code Here

        sout.setValue(message);
        sendObject(sout);
    }

    public void keepAlive() {
        sendObject(new ServiceObject("name",ServiceTags.KeepAlive));
    }
View Full Code Here

            assignedList.setVisible(true);
            unassignedList.setVisible(true);
            updateFlightLists();
        }

        ServiceObject sout = new ServiceObject(nickName, ServiceTags.FunctionChoosen);
        sout.setValue(func);
        connection.sendObject(sout);
    }
View Full Code Here

        }
        return tempStr;
    }

    public void sendUserList(IUserInfo to) {
        ServiceObject sout = new ServiceObject("Server", ServiceTags.UserList);
        sout.setUserList(getUserArray());
        sendMessage(sout, to);
    }
View Full Code Here

        sout.setUserList(getUserArray());
        sendMessage(sout, to);
    }

    public void broadcasUserList(IUserInfo changer) {
        ServiceObject sout = new ServiceObject("Server", ServiceTags.UserList);
        sout.setUserList(getUserArray());
        broadcast(sout, changer);
    }
View Full Code Here

                    if (input instanceof ServiceObject) {
                        so = (ServiceObject) input;
                       
                        if (so.isTag(ServiceTags.KeepAlive)) {
                            System.out.println("sending keepalive");
                            ui.getOOS().writeObject(new ServiceObject("Server",ServiceTags.KeepAlive));
                            //ATMserver.keepAlive(so, ui);

                        // es wird kontrolliert ob sich der Client angemeldet hat, wenn nicht wird die Verbindung geschlossen
                        } else if (so.isTag(ServiceTags.ClientLoggedIn)) {
                            if(model.isNameUnique(so.getSenderName())){
                                ui.setNickName(so.getSenderName());
                                model.addUserInfo(ui);
                               
                                System.out.println(so.getSenderName()+" logged in.");
                                //Sending functionlist
                                ServiceObject sout=new ServiceObject("Server",ServiceTags.FunctionList);
                                sout.setFunctions(model.getFuncs());
                                System.out.println("Sending functionlist to: "+ui.getNickName());
                                ui.getOOS().writeObject(sout);
                                model.getServer().sendUserList(ui);
                                model.sendUpdateList(ui);

                               
                            } else {
                                System.out.println(so.getSenderName()+" already exists, closing connection.");
                                ui.getOOS().writeObject(new ServiceObject("Server",ServiceTags.NameAlreadyExists));
                                throw new IOException();
                            }

                        }else if (so.isTag(ServiceTags.chatMessage)) {
                            ServiceObject sout = new ServiceObject(ui.getNickName(), ServiceTags.chatMessage);
                            sout.setValue(so.getValue());
                            model.getServer().broadcast(sout, ui);
                        }
                       
                        else if (so.isTag(ServiceTags.ClientLoggedOut)) {
                            throw new IOException();
View Full Code Here

    public void addFunction(String func) {
        if (func != null && !(func.equals("Pilot") || func.equals("-no function-"))) {
            resetPlanes(func);
            funcList.add(func);
            ServiceObject sout = new ServiceObject("Server", ServiceTags.FunctionList);
            sout.setFunctions(getFuncs());
            server.broadcast(sout);
        }
    }
View Full Code Here

    public void removeFunction(String func) {
        if (!(func.equals("Pilot") || func.equals("-no function-"))) {
            funcList.remove(func);
        }
        ServiceObject sout = new ServiceObject("Server", ServiceTags.FunctionList);
        sout.setFunctions(getFuncs());
        server.broadcast(sout);
    }
View Full Code Here

TOP

Related Classes of messages.ServiceObject

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.