Jump to content

Server Socket


bushin

Recommended Posts

Bom dia ,

nao estou a conseguir gerir(sincronizar) os pedidos que vêem do cliente socket:

try {
   	         
	Socket connected = insocket.accept();
	System.out.print("Server has connected!\n");
          
	ObjectInputStream recebeObject = new ObjectInputStream(skt.getInputStream());     
	DataInputStream recebeDados = new DataInputStream(skt.getInputStream());
   	DataInputStream OpMenu = new DataInputStream(skt.getInputStream());       
                ObjectOutputStream enviaObject = new ObjectOutputStream(skt.getOutputStream());  
             
                switch (OpMenu.read()) 
                          {	
			case 1:{
					//Insere            	     	
				break;
                          }
                        case 2 :{
            	                       //Apaga           	   
				break;
                          }					            				          		               
                         case 3: {
					//pesquisa
                                        break;
                           }
                                  (...)

Se comentar o recebeDados e recebeObject. Funciona bem, o problema a que depois não consigo receber objectos do cliente.

Qual será a melhor forma de implementar um sistema deste tipo.

cumprimentos,

Bushin

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.