my $c_session = Net::BEEP::Lite::ClientSession->new(Socket => $sock); my $channel_num = $c_session->start_channel('http://some/profile/url', (ServerName => "some.host.org")); my $resp = $c_session->send_and_recv_message(ContentType => "text/plain", Content => "hello!"); $c_session->close_channel($channel_num); $c_session->close_channel(0); # close session.
This is the session subclass that handles the pure "client" case. This models the case of a process sending individual messages and dealing with individual replies on its own. In general, "clients" do not advertise any profiles, so it is impossible for the peer to open any new channels.
This is the main constructor for this class. It takes a named parameter list. It accepts all parameters defined by the
initialize method (see below) and its superclass constructor (see
This constructor will attempt to establish a valid BEEP session (i.e., it will send and process the greeting message.) if it is passed an actual socket in the constructor. If not (or if NoGreeting is set to true), it is up to the calling code to send the greeting.
This will initialize the object. It is generally called from the constructor. At the moment it does not define any new named parameters in addition to those supported by the superclass.
Sends a start channel request to the peer. The named arguments are:
The URI of the BEEP profile to use this channel. This is mandatory.
The "server name" to present to the server. Essentially this is the name the client thinks the server is. It is optional.
Data to piggyback with the start channel request. This is optional.
Set this to true of the StartData value is base64 encoded.
This returns the channel number started, or dies on failure.
start_channel_message method in
Sends a "close" message for the given channel. See the
Net::BEEP::Lite:MgmtProfile for more information.
This is a convenience method for creating new messages. It accepts the following named parameters:
One of "MSG", "RPY", etc. Defaults to "MSG".
The channel number to use. This defaults to the "current channel", which is the last successfully opened channel.
The message content.
The MIME content type. This defaults to 'application/octet-stream'.
This is a convenience method for send and message and receiving the response to it all in one step. This takes the same named parameters as the
Note: currently this will have trouble with multiple channels.
Returns the profile selected from the last successful start channel.
Returns the current channel number.