sockets - Find and print to network printer by IP address in Java -


i've read tons of similar questions , haven't gotten anywhere..

what i'm trying connect printer directly ip (not 1 that's in windows devices list) , print document it.

here's i've tried far (didn't work, no idea why):

try{     socket sock = new socket("1.2.3.4", 9100);     printwriter ostream = new printwriter(sock.getoutputstream());         ostream.println("hello world");         ostream.close();         sock.close();  } catch (unknownhostexception e){     e.printstacktrace(); }  catch (ioexception e) {      e.printstacktrace(); } 

i found problem. can try network printer code.

https://blog.entelect.co.za/view/3213/android-printing-to-a-network-printer

i saw many examples example worked. guess there connection problem printer.


Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -