Socket Keep-Alive


 
Thread Tools Search this Thread
Top Forums Programming Socket Keep-Alive
Prev   Next
# 7  
Old 05-31-2016
I do similar operations where the reply contains the size in the metadata in FIX data.
I use the following:

MSG_PEEK
This flag causes the receive operation to return data from the
beginning of the receive queue without removing that data from
the queue. Thus, a subsequent receive call will return the same
data.

Then you can get the content-length and work out how much to read, then use

MSG_WAITALL(since Linux 2.2)
This flag requests that the operation block until the full
request is satisfied. However, the call may still return less
data than requested if a signal is caught, an error or disconā€
nect occurs, or the next data to be received is of a different
type than that returned.
This User Gave Thanks to bigearsbilly For This Post:
 
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. What is on Your Mind?

Is this forum alive?

Odd thing. I posted in the Solaris forum, new user, just asking for a bit of advice. Nothing too complicated. As of this post there have been 140 views and zero replies. So that got me thinking, is this normal? I had a look around, and I see the same thing on many other threads, and in other... (2 Replies)
Discussion started by: _JonB_
2 Replies

2. IP Networking

Clarification - Setting socket options at the same time when socket is listening

I need clarification on whether it is okay to set socket options on a listening socket simultaneously when it is being used in an accept() call? Following is the scenario:- -- Task 1 - is executing in a loop - polling a listen socket, lets call it 'fd', (whose file descriptor is global)... (2 Replies)
Discussion started by: jake24
2 Replies

3. Programming

Error with socket operation on non-socket

Dear Experts, i am compiling my code in suse 4.1 which is compiling fine, but at runtime it is showing me for socket programming error no 88 as i searched in errno.h it is telling me socket operation on non socket, what is the meaning of this , how to deal with this error , please... (1 Reply)
Discussion started by: vin_pll
1 Replies

4. Programming

socket function to read a webpage (socket.h)

Why does this socket function only read the first 1440 chars of the stream. Why not the whole stream ? I checked it with gdm and valgrind and everything seems correct... #include <stdio.h> #include <stdlib.h> #include <sys/types.h> #include <sys/stat.h> #include <string.h> #include... (3 Replies)
Discussion started by: cyler
3 Replies

5. Programming

which socket should socket option on be set

Hi all, On the server side, one socket is used for listening, the others are used for communicating with the client. My question is: if i want to set option for socket, which socket should be set on? If either can be set, what's the different? Again, what's the different if set option... (1 Reply)
Discussion started by: blademan100
1 Replies

6. UNIX for Advanced & Expert Users

connect problem for sctp socket (ipv6 socket) - Runtime fail Invalid Arguments

Hi, I was porting ipv4 application to ipv6; i was done with TCP transports. Now i am facing problem with SCTp transport at runtime. To test SCTP transport I am using following server and client socket programs. Server program runs fine, but client program fails giving Invalid Arguments for... (0 Replies)
Discussion started by: chandrutiptur
0 Replies

7. Shell Programming and Scripting

Can we keep our script alive while logging out.

Hi I want to keep my script running even when i am logged off from the box. can we run the script in background which can automatically run every hour? Please advise. Thank you (1 Reply)
Discussion started by: Prateek007
1 Replies

8. UNIX for Dummies Questions & Answers

Socket still alive!!

Hi, I'm investigate about a problem regarding a connection between two server (S1 and S2). A client software on S1 made a pool of connections on S2; for some reason some connections end but sockets still alive on S2 and not on S1. I always knew about sockets as a pair of processes; is it... (1 Reply)
Discussion started by: grado
1 Replies

9. Programming

HTTP Keep-Alive socket problem

Hello everyone, I am a newbie in UNIX/Linux socket programming. This is a class project that I had trouble with. ================================================== I was trying to make “Keep-Alive” HTTP connections to the server in a tiny web crawler project. Here is the problem: when I tried... (0 Replies)
Discussion started by: imdupeng
0 Replies
Login or Register to Ask a Question
SSL(3)							User Contributed Perl Documentation						    SSL(3)

NAME
HTTP::Daemon::SSL - a simple http server class with SSL support SYNOPSIS
use HTTP::Daemon::SSL; use HTTP::Status; # Make sure you have a certs/ directory with "server-cert.pem" # and "server-key.pem" in it before running this! my $d = HTTP::Daemon::SSL->new || die; print "Please contact me at: <URL:", $d->url, "> "; while (my $c = $d->accept) { while (my $r = $c->get_request) { if ($r->method eq 'GET' and $r->url->path eq "/xyzzy") { # remember, this is *not* recommened practice :-) $c->send_file_response("/etc/passwd"); } else { $c->send_error(RC_FORBIDDEN) } } $c->close; undef($c); } DESCRIPTION
Instances of the HTTP::Daemon::SSL class are HTTP/1.1 servers that listen on a socket for incoming requests. The HTTP::Daemon::SSL is a sub-class of IO::Socket::SSL, so you can perform socket operations directly on it too. The accept() method will return when a connection from a client is available. In a scalar context the returned value will be a reference to a object of the HTTP::Daemon::ClientConn::SSL class which is another IO::Socket::SSL subclass. In a list context a two-element array is returned containing the new HTTP::Daemon::ClientConn::SSL reference and the peer address; the list will be empty upon failure. (Note that version 1.02 erroneously did not honour list context). Calling the get_request() method on the HTTP::Daemon::ClientConn::SSL object will read data from the client and return an HTTP::Request object reference. This HTTPS daemon does not fork(2) for you. Your application, i.e. the user of the HTTP::Daemon::SSL is reponsible for forking if that is desirable. Also note that the user is responsible for generating responses that conform to the HTTP/1.1 protocol. The HTTP::Daemon::ClientConn class provides some methods that make this easier. METHODS
The following methods are the only differences from the HTTP::Daemon base class: $d = new HTTP::Daemon::SSL The constructor takes the same parameters as the IO::Socket::SSL constructor. It can also be called without specifying any parameters, but you will have to make sure that you have an SSL certificate and key for the server in certs/server-cert.pem and certs/server-key.pem. See the IO::Socket::SSL documentation for how to change these default locations and specify many other aspects of SSL behavior. The daemon will then set up a listen queue of 5 connections and allocate some random port number. A server that wants to bind to some specific address on the standard HTTPS port will be constructed like this: $d = new HTTP::Daemon::SSL LocalAddr => 'www.someplace.com', LocalPort => 443; SEE ALSO
RFC 2068 IO::Socket::SSL, HTTP::Daemon, Apache COPYRIGHT
Code and documentation from HTTP::Daemon Copyright 1996-2001, Gisle Aas Changes Copyright 2003-2004, Peter Behroozi This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. POD ERRORS
Hey! The above document had some coding errors, which are explained below: Around line 164: You forgot a '=back' before '=head1' perl v5.12.1 2008-02-12 SSL(3)