2005-01-31 10:45:46

by Karl Kiniger

[permalink] [raw]
Subject: How peek at tcp socket data w/o reading it

Hi,

hack wanted:

is it possible to peek a few bytes from a tcp socket which is
ready to read without actually reading the data? (or some
means to push already read data back similar to ungetc)

Any creative ideas welcome.

Karl
--
Karl Kiniger mailto:[email protected]
GE Medical Systems Kretztechnik GmbH & Co OHG
Tiefenbach 15 Tel: (++43) 7682-3800-710
A-4871 Zipf Austria Fax: (++43) 7682-3800-47


2005-01-31 11:16:22

by Martin Zwickel

[permalink] [raw]
Subject: Re: How peek at tcp socket data w/o reading it

On Mon, 31 Jan 2005 11:45:32 +0100
"Kiniger, Karl (GE Healthcare)" <[email protected]> bubbled:

> Hi,
>
> hack wanted:
>
> is it possible to peek a few bytes from a tcp socket which is
> ready to read without actually reading the data? (or some
> means to push already read data back similar to ungetc)

ret = recv(fd, buf, len, MSG_PEEK);


--
MyExcuse:
telnet: Unable to connect to remote host: Connection refused

Martin Zwickel <[email protected]>
Research & Development

TechnoTrend AG <http://www.technotrend.de>


Attachments:
(No filename) (189.00 B)

2005-01-31 11:39:33

by Karl Kiniger

[permalink] [raw]
Subject: Re: How peek at tcp socket data w/o reading it

Thanks very much,

thats exactly what I needed.

Karl

On Mon, Jan 31, 2005 at 12:16:16PM +0100, Martin Zwickel wrote:
>
> On Mon, 31 Jan 2005 11:45:32 +0100
> "Kiniger, Karl (GE Healthcare)" <[email protected]> bubbled:
>
> > Hi,
> >
> > hack wanted:
> >
> > is it possible to peek a few bytes from a tcp socket which is
> > ready to read without actually reading the data? (or some
> > means to push already read data back similar to ungetc)
>
> ret = recv(fd, buf, len, MSG_PEEK);
>
> --
> MyExcuse:
> telnet: Unable to connect to remote host: Connection refused
>
> Martin Zwickel <[email protected]>
> Research & Development
>
> TechnoTrend AG <[1]http://www.technotrend.de>
> )
>
> References
>
> 1. http://www.technotrend.de/

--
Karl Kiniger mailto:[email protected]
GE Medical Systems Kretztechnik GmbH & Co OHG
Tiefenbach 15 Tel: (++43) 7682-3800-710
A-4871 Zipf Austria Fax: (++43) 7682-3800-47