• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

TCP\IP communication

 
Neeba Rebbaca
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to send data xml to client's TCP\IP port over a web.I don't want to use Applet. Is there any other way to do it?
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, what makes a "client" is that it has connected to a server somehow - how did it do that? Can't you use whatever connection it has made already?
 
Neeba Rebbaca
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I need to create a xml and that xml to a tcp\ip port where a printer is connected, this is printer is connected to a network. This XML creation and sending should happen from a web page,which is constructed using .net and the front end scripts are html and js. I want to know whether i can do this xml construction and sending using java.
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So this printer would be connected to the machine that accesses the web page? Or to some other machine? If the server process that implements this uses .Net, why should the sending of this message happen in Java? Wouldn't it be easier to use .Net as well?
 
Neeba Rebbaca
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Its another machine. No the one which access the webpage. all i need to do is just send data a port. i just tried using Socket in java as standalone. can it done using servlet or jsp?

 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1) What happened when you tried? Be detailed.

2) Is the machine with the printer reachable from the machine that tries to connect to it, and is that port (which one?) open?

3) When is this code called? As I understand it, the web page that triggers it is written in .Net - how does that trigger Java code?

4) ObjectOutputStream is almost certainly the wrong class to use (it definitely is the wrong one if the receiving process is not a Java process - which is highly unlikely for a printer). What kind of data/protocol does the receiving machine expect?
 
Neeba Rebbaca
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your reply,Ulf Dittmer.

1. I create it as a basic java class and executed from command prompt. it worked. (Printer is a Intermac)

2. Though it works based on .net, the front end are in html and javascript.

3. Code should be called, when a button is clicked on the html.

4. Now, my question is if i convert it to either servlet or jsp, will this works?means, will the data be sent to tcp\ip port(I don't have printer to check it right now)
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
2. Though it works based on .net, the front end are in html and javascript.

The client side is irrelevant since this code would be executed from the server.

4. Now, my question is if i convert it to either servlet or jsp, will this works?means, will the data be sent to tcp\ip port

Well, if it works from your desktop it might work from the server, provided it has network access to the printer. You would do this from a servlet, not from a JSP. You'd need to rewrite the relevant .Net code/pages into servlets/JSPs, obviously.
 
Neeba Rebbaca
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your reply. Planning to call from a button by this way , "http://myservlet/PrinterServlet?params="data"

One more question, what happens if the xml file i send is going to a large one ? Will there be any restriction ?
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Define "large". Printers can normally handle documents hundreds of pages long.
 
Neeba Rebbaca
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Large i mean here is, I'm going to post data to tcp\ip port as a form of xml, so my question is can tcp ip can handle a voluminous data? say like 15MB of xml data?
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
15MB is not a particularly large file size these days. I'm sure you have downloaded files much larger than that.
 
Neeba Rebbaca
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks for your reply.
 
Winston Gutkowski
Bartender
Pie
Posts: 10509
64
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Neeba Rebbaca wrote:Its another machine. No the one which access the webpage. all i need to do is just send data a port. i just tried using Socket in java as standalone. can it done using servlet or jsp?

It seems like an odd way to do this: a bit like the network equivalent of cat-ing directly to a printer device, which is never a very good idea.

Couldn't you just use the Java Print Service? I'm no expert on this stuff, but it would seem odd if it doesn't allow you to print to a network printer. Or is there other stuff going on that you haven't told us about?

Winston
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic