I want to do print functionality in my android application using wifi printer. For that i have done following. But I dont know how i to get port number.i have refer the question asked before in which it tells that port number not required but how to do without port number?
Asked
Active
Viewed 1.8k times
0
-
possible duplicate of [How to get Port number of wifiNetwork active currently in android](http://stackoverflow.com/questions/14749497/how-to-get-port-number-of-wifinetwork-active-currently-in-android) – unwind Apr 09 '13 at 12:11
-
is that for some specific device or tab ? – Chintan Khetiya Apr 09 '13 at 12:11
-
no...i want to print from any android device...for that only i want – shivani patel Apr 09 '13 at 12:13
-
And i already said that this is repeated question... – shivani patel Apr 09 '13 at 12:14
-
Yes it is, and the answer is the same as well. – user207421 Apr 09 '13 at 22:04
-
@shivanipatel did you get any solution for this? i am also facing same problem. without port number can we print pdf(which is in internal storage) and that pdf has data in tables and images. – BHARADWAJ Marripally Oct 16 '18 at 06:34
1 Answers
2
WLAN is not connected via a port no. It only has an ip address.

asloob
- 1,308
- 20
- 34
-
2`InetSocketAddress objEndPoint = new InetSocketAddress(IP, port);`for follwing what i should do? – shivani patel Apr 09 '13 at 12:12
-
Here you are trying to connect to a Server Socket which is initialised with a `port no` on a machine with its own `IP`. You need to know these two beforehand – asloob Apr 09 '13 at 12:15
-
ok...but port is not needed in WLAN so using ip address how to connect ? – shivani patel Apr 09 '13 at 12:17
-
You need to be connected to the WLAN before connecting to the Server Socket, ie. before doing this `InetSocketAddress objEndPoint = new InetSocketAddress(IP, port);` – asloob Apr 09 '13 at 12:18
-
have you found that how to connect printer with wifi? if yes, then please tell me... – Denny Sharma Oct 28 '13 at 09:40
-
-
@shivanipatel did you find how to connect InetSocketAddress without knowing port number? Thanks in advance – sandeepmaaram May 08 '17 at 06:33