clinet socket connect failed

Problems with WiFi, SQLite ,Bluetooth, WiMax, Proxies, etc...

clinet socket connect failed

Postby sardis » Sun Jan 20, 2008 3:05 pm

I write a client socket program
and I try to new a socket class
but I don't know why the port number will become zero
can somebody help me, please?


Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2. try{
  3.  
  4.                 this.socket=new Socket();
  5.  
  6.                 this.socket.connect(new InetSocketAddress((this.host), Integer.parseInt(this.port)));
  7.  
  8.                 print(socket.toString());
  9.  
  10.                 print(Integer.toString(socket.getPort()));
  11.  
  12.                 this.input=new Scanner(this.socket.getInputStream());
  13.  
  14.                 this.output=new Formatter(this.socket.getOutputStream());
  15.  
  16.                 this.output.flush();
  17.  
  18. }
  19.  
  20. catch(Exception e){
  21.  
  22.                 e.printStackTrace();
  23.  
  24. }
Parsed in 0.031 seconds, using GeSHi 1.0.8.4
sardis
Once Poster
Once Poster
 
Posts: 1
Joined: Sun Jan 20, 2008 2:56 pm

Top

Return to Networking & Database Problems

Who is online

Users browsing this forum: callmefrank and 3 guests