How to use sockets ?

kbpress

Member
Hello,

i found a very nice feature of sending data to the RIP using "sockets". The concept of sockets is clear to me, but how can i use this connection in detail. For now i send PSdata over the opened socket connection to the RIP, then close the socket which causes the RIP to interpret the send code.
How can i tell that data is finish and get the reply of the RIP?
How can i use async-socket to get current state of RIP? I think there must be some kind of pscode to send to get an reply.

Anyone interested in some knowledgetransfere is welcome :)
 
Re: How to use sockets ?

Hi Oliver,

You're not quite doing the transfer right. You should open the socket, send
the data, send an EOF 'signal' and then wait for the RIP to finish the job
and close the socket. That's how you then know the RIP has finished.

This is not RIP specific, but is general socket handling. I suggest you go
read a good book on how to use sockets.

The async stuff is well cool, but again it's not documented for external use
as far as I'm aware.

Regards,

Andy.

Andy Cave,
Chief Executive Officer,
Hamillroad Software Limited.
www.firstproof.com
www.hamillroad.com
 
Re: How to use sockets ?

Hi Andy (nice to meet you again :)

well i think you're right about the socket stuff. Shure, closing the socket implies an EOF. But how can i otherwise send it? I tried to give and chr(4) which is like CTRL-D, but no result, also chr(0). So what could be the EOF char to send (using PHP) ?
 
Re: How to use sockets ?

Okay, forgive the question to your question, but what is "sockets"? Is it software?? Am I going to feel like an idiot? ;)
 
Re: How to use sockets ?

Hi Brian,

A socket is a means of communication, like Appletalk. The Hqn RIP has Inputs
which are created/built from plugins. As well as a Spool Folder Input
Plugin, it also has one for Appletalk and Sockets. Most people are familiar
with the Appletalk and Spool Folder Inputs, but not with the Socket Input.

Sockets run on Macs, PCs, Windows, Mac OS9, OSX, Unix, etc...

It's quite easy to use a socket, although most people get it wrong ('cause
the EOF handling is not straight forward and most people don't understand
how to do it).

Regards,

Andy.

Andy Cave,
Chief Executive Officer,
Hamillroad Software Limited.
www.firstproof.com
www.hamillroad.com
 
Re: How to use sockets ?

It's quite easy to use a socket, although most people get it wrong ('cause
the EOF handling is not straight forward and most people don't understand
how to do it).

Like me, so please let us know :)
 
Re: How to use sockets ?

Sockets build a communication channel. The Endpoint of each communication partner is a socket, which itself is identified by an address and port. When you use a browser to access an website you do socket communication, in which your browser connects to the address entered in the URL field, and the port number 80, which is defined as the http port.
Ports lower than 1024 are reserved and should not be used, but all above (up to 65535) could be used as like.

So "Sockets" only defines the type of communication, not what is transferred, or "spoken" over it. There we found another friend called "protocol" which defines how endpoints "talk" to eachother. Because they use only one channel of communication it's called half-duplex. This implies the need of "I'm finished with talking, now it's your turn" signal without closing the channel. This is defined by the protocol and mostly called "EOF/EOT" (EndOfFile or EndOfTransmission). It's also up to the protocol what's allowed to talk, so both endpoints understand eachother. Some protocols simply use newline chars or empty lines for that.
Another need for EOF signals is the fact, that the receiving socket may not know when the sender has finished sending data. It's absolutly legal to pause transmission. Think of an telnet session.

The last is what i'm struggling with. I know i can simply send PSDATA to the socket on the HQ-RIP Computer. The problem is, that i need to send the EOF to cause the RIP to stop listening for data and exec the job, but i don't know which EOF char the HQ-Socket expects. If i close the socket on the sender side will cause the RIP to exec the job, but i can't get the result of this operation, which is normally send back from the RIP to me.

Currently i use PHP5 to communicate. There it's easy to check on EOF but not to send one.
 
Re: How to use sockets ?

Hi Oliver,

There is no such thing as an EOF char on sockets. You signal EOF by
initiating a shutdown sequence (and this is not the same as closing the
socket). Again, go read a book on socket & TCP/IP programming.

Also, to get the RIP to exec your PSCode, don't do a close, do a flush on
the data.

Regards,

Andy.
 
Re: How to use sockets ?

Correct (although from a technical view point, it's not a pipe!). People
tend not to use it - applications (like FirstPROOF, GPS Navigator, EWF,...)
do.
 
Re: How to use sockets ?

Hi Andy,

> There is no such thing as an EOF char on sockets. You signal EOF by
> initiating a shutdown sequence (and this is not the same as closing the
> socket). Again, go read a book on socket & TCP/IP programming.

i finally managed to do this by using stream_socket_shutdown() function. It will shutdown a reading/writing or both connection. This will do the job, the RIP process the data and sends the result back to me :)

Very well. Now, what to do next? Is it possible to change the settings by PS (like what pagesize to use, where to save TIFF files or what calibration to use) ?

You tell, that the async-socket is not well described. I would say the simple socket also... but what about the JDF enabler? JDF is very well described and it seems it's included in GPS without any extra costs (right?!).
 

PressWise

A 30-day Fix for Managed Chaos

As any print professional knows, printing can be managed chaos. Software that solves multiple problems and provides measurable and monetizable value has a direct impact on the bottom-line.

“We reduced order entry costs by about 40%.” Significant savings in a shop that turns about 500 jobs a month.


Learn how…….

   
Back
Top