The Artima Developer Community
Sponsored Link

Java Answers Forum
Socket Programming

3 replies on 1 page. Most recent reply: Nov 22, 2005 6:05 AM by Kondwani Mkandawire

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 3 replies on 1 page
rakesh

Posts: 9
Nickname: rocky2005
Registered: Apr, 2005

Socket Programming Posted: Nov 11, 2005 9:52 AM
Reply to this message Reply
Advertisement
I want to use java socket programming to write a program which enables client to use a printer connected to server machine. Is it possible ? If yes, how ? Please Help me.


Kondwani Mkandawire

Posts: 530
Nickname: spike
Registered: Aug, 2004

Re: Socket Programming Posted: Nov 14, 2005 7:29 AM
Reply to this message Reply
> I want to use java socket programming to write a program
> which enables client to use a printer connected to
> server machine. Is it possible ? If yes, how ? Please Help
> me.

Its definitely possible, I'm not exactly sure how to go about
it though. However here is a long shot, anyone feel free to
dip in. You will need to know what Messages the Server
requires and at what port, you will also need to know
what responses it gives, that's the starting point. Anyone
want to add anything?? As I said that's a long shot on
my part.

rakesh

Posts: 9
Nickname: rocky2005
Registered: Apr, 2005

Re: Socket Programming Posted: Nov 22, 2005 5:09 AM
Reply to this message Reply
I didn't get what u want to tell. Please explain.

Kondwani Mkandawire

Posts: 530
Nickname: spike
Registered: Aug, 2004

Re: Socket Programming Posted: Nov 22, 2005 6:05 AM
Reply to this message Reply
> > I want to use java socket programming to write a
> program
> > which enables client to use a printer connected to
> > server machine. Is it possible ? If yes, how ? Please
> Help
> > me.
>
> Its definitely possible, I'm not exactly sure how to go
> about
> it though. However here is a long shot, anyone feel free
> to
> dip in. You will need to know what Messages the Server
> requires and at what port, you will also need to know
> what responses it gives, that's the starting point.

For example if you send a Get Request to Port 80 of
a WebServer you get the index page in HTML format
(if I'm not mistaken) Something like that.

E.g. Client Sends to port the Serialized Object with
defined properties, or simply a string as indicated
below -

// Send the String hello to port 545 on a configured
// server. i.e. the client Object already has the
// server it is sending to configured as a String
// and has the Socket open at 545.
client.send("hallo");

// The Server is expecting "hello" else it send you back
//an error.
//server listens.
while(no_incoming_strings){
    listenAtPort(545);
    if(stringReceived){
       if(receivedString.equals("hello")){
           return ("OK I have started Printing");
           //  if using send "break" out of loop
       }else{
           //  or send
           return error;
       }
    }
}


So you would have to know what port the Computer is
listening for the print Service at (that is the Server
computer).

I think it should be something like that. Otherwise,
just Google Cups if you're using Linux, I'm still trying
top learn it so I can't tell you much about it.

> Anyone
> want to add anything?? As I said that's a long shot on
> my part.

Flat View: This topic has 3 replies on 1 page
Topic: Importing classes Previous Topic   Next Topic Topic: Comparing Command-Line Arguments

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use