1 Replies - 739 Views - Last Post: 27 July 2007 - 08:20 AM Rate Topic: -----

#1 scarecrowfeild  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 33
  • Joined: 14-July 07

program can run but...

Posted 27 July 2007 - 08:17 AM

i had write 2 programs.1 for each client and server.
i already compile and run both of them.
But Server didn't send the answer to Client after it compute the numbers.

[color=#3333FF]this is the Client side

	 Socket connection=new Socket("localhost",port);

			DataInputStream in=new DataInputStream(connection.getInputStream());
			DataOutputStream out=new DataOutputStream(connection.getOutputStream());
		InputStreamReader isr=new InputStreamReader(System.in);
		BufferedReader br=new BufferedReader(isr);
		String stnum=JOptionPane.showInputDialog("Enter integer less than 10 digits");
			}//end try

this is the Server side
		{ServerSocket serverSocket=new ServerSocket(Port);//create server socket
		Socket connection=serverSocket.accept();//listening for connection request
	 	//create input&output stream
		DataInputStream receive=new DataInputStream(connection.getInputStream());
		DataOutputStream send=new DataOutputStream(connection.getOutputStream());
		System.out.println("connection started");
		for(int temp=number;temp>=0;temp=temp/10){
		int b=number%10;
			total= total+b;
			number=number/10;}//end for
			}//end do
		}//end try

edit: added code tags ~ jayman9

Is This A Good Question/Topic? 0
  • +

Replies To: program can run but...

#2 PennyBoki  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 55
  • View blog
  • Posts: 2,342
  • Joined: 11-December 06

Re: program can run but...

Posted 27 July 2007 - 08:20 AM

Hi scarecrowfeild can you put the code next time between code tags and not in colour like this, it's hard to read it this way thx.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1