This week's book giveaway is in the JavaScript forum.
We're giving away four copies of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js and have Paul Jensen on-line!
See this thread for details.
Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Socket Connection Problem  RSS feed

 
sam sawant
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

in my program
i want ipaddress & port number to be entered by the user in text fields. this values should passed to socket connection

what i did
ipaddress=tf1.gettext()
port_no.=tf2.gettext()

& then

Socket s=new socket(ipaddress,port_no);


but this doesn't work....so do help me out......
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You didn't say how it doesn't work, but in any case there is no Socket (String, String) constructor. You need to use an int for the port number. If that's not the problem you're facing, TellTheDetails of what is the problem.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!