100+ results for 'MSG_PEEK'

Not the results you expected?

AsyncFile.py (git://pkgs.fedoraproject.org/eric) Python · 293 lines

177 # delivered as two separate events. Therefore we make sure we only

178 # read a line at a time.

179 line = self.sock.recv(size, socket.MSG_PEEK)

180

181 eol = line.find('\n')

socket_types.hpp (https://github.com/Bes666/evemu_incursion.git) C++ Header · 176 lines

110 const int shutdown_send = SD_SEND;

111 const int shutdown_both = SD_BOTH;

112 const int message_peek = MSG_PEEK;

113 const int message_out_of_band = MSG_OOB;

114 const int message_do_not_route = MSG_DONTROUTE;

154 const int shutdown_send = SHUT_WR;

155 const int shutdown_both = SHUT_RDWR;

156 const int message_peek = MSG_PEEK;

157 const int message_out_of_band = MSG_OOB;

158 const int message_do_not_route = MSG_DONTROUTE;

mod_jaxer_message.h (https://github.com/absynce/Jaxer.git) C Header · 150 lines

104 * Like read, except do not advance *pos

105 */

106 int jxr_msg_peek_int16(unsigned char* buf, apr_size_t pos);

107

108 char jxr_msg_get_byte(unsigned char* buf, apr_size_t *pos);

109 char jxr_msg_peek_byte(unsigned char* buf, apr_size_t *pos);

110

111 /**

application_manager.rb (https://gitlab.com/gitnyasha/zimcreative) Ruby · 140 lines

123 loop do

124 IO.select([child])

125 break if child.recv(1, Socket::MSG_PEEK).empty?

126 sleep 0.01

127 end

recvfrom_spec.rb (https://github.com/rklemme/ruby.git) Ruby · 98 lines

33

34 it "uses different message options" do

35 @client.send("foobar", Socket::MSG_PEEK)

36 sock = @server.accept

37 peek_data = sock.recvfrom(6, Socket::MSG_PEEK) # Does not retrieve the message

socket.d (https://github.com/SiegeLord/Tango-D2.git) D · 498 lines

94 MSG_EOR

95 MSG_OOB

96 MSG_PEEK

97 MSG_TRUNC

98 MSG_WAITALL

os_socket.h (https://bitbucket.org/oregon/oregoncore/) C Header · 306 lines ✨ Summary

This C header file provides a set of socket-related functions and constants for use in C programs. It defines various socket options, error codes, and protocol families (e.g., IPv4, IPv6) that can be used to create and manage sockets. The code also includes function prototypes for receiving and sending data over sockets with timed waits, allowing for more precise control over timeouts.

151 #endif /* MSG_OOB */

152

153 #if !defined (MSG_PEEK)

154 # define MSG_PEEK 0x2

155 #endif /* MSG_PEEK */

156

157 #if !defined (SOCK_STREAM)

u_network.c (https://bitbucket.org/peixuan/chromium_r197479_base.git) C · 188 lines

89 {

90 #if defined(PIPE_HAVE_SOCKETS)

91 return recv(s, data, size, MSG_PEEK);

92 #else

93 return -1;

socket.php (https://github.com/philbrookes/Game.git) PHP · 99 lines

80 //Returns true if the remote end is still connected, false if the remote end has hung up.

81 public function isAlive(){

82 $res = @socket_recv($this->sockHandle, $data, 1024, MSG_PEEK);

83 $result = socket_last_error($this->sockHandle);

84 //if bytes received is zero rather than blank, client has hung up

ngx_http_ajp_msg.c (https://github.com/yaoweibin/nginx_ajp_module.git) C · 482 lines

243

244 ngx_int_t

245 ajp_msg_peek_uint16(ajp_msg_t *msg, uint16_t *rvalue)

246 {

247 uint16_t value;

251

252 if ((buf->pos + 2) > buf->last) {

253 return ajp_log_overflow(msg, "ajp_msg_peek_uint16");

254 }

255

264

265 ngx_int_t

266 ajp_msg_peek_uint8(ajp_msg_t *msg, u_char *rvalue)

267 {

268 if ((msg->buf->pos + 1) > msg->buf->last) {

socket.h (https://gitlab.com/gl-xinshouyong/1407-mifi-customer-tmp) C Header · 221 lines

23 #define NL_SOCK_PASSCRED (1<<1)

24 #define NL_OWN_PORT (1<<2)

25 #define NL_MSG_PEEK (1<<3)

26 #define NL_NO_AUTO_ACK (1<<4)

27

150

151 /**

152 * Enable use of MSG_PEEK when reading from socket

153 * @arg sk Netlink socket.

154 */

155 static inline void nl_socket_enable_msg_peek(struct nl_sock *sk)

156 {

157 sk->s_flags |= NL_MSG_PEEK;

auth-pwd.c (https://github.com/Shirk/zsrelay.git) C · 259 lines

46 int code = 0;

47

48 r = timerd_read(s, buf, sizeof(buf), TIMEOUTSEC, MSG_PEEK);

49 if ( r < 2 )

50 return(-1);

69

70 /* get passwd */

71 r = timerd_read(s, buf, sizeof(buf), TIMEOUTSEC, MSG_PEEK);

72 if ( r < 1 )

73 return(-1);

vchi.h (https://github.com/ThomasHabets/linux.git) C Header · 159 lines

107 // The message is not dequeued, so a subsequent call to peek or dequeue

108 // will return the same message.

109 extern int32_t vchi_msg_peek(struct vchi_service_handle *handle,

110 void **data,

111 uint32_t *msg_size,

owsl_tcp.c (https://github.com/VoxOx/VoxOx.git) C · 330 lines

65

66 /* get packet and packet size */

67 received_bytes = recv (socket->system_socket, buffer, OWSL_TCP_BUFFER_SIZE, MSG_PEEK) ;

68 if (received_bytes > 0)

69 {

constdefs.h (https://github.com/GunioRobot/rhodes.git) C Header · 1788 lines

430 # endif

431 #endif

432 #if !defined(MSG_PEEK)

433 # if defined(HAVE_CONST_MSG_PEEK)

434 # define MSG_PEEK MSG_PEEK

435 # endif

436 #endif

tcpstream.cpp (https://github.com/azboul/multitheftauto.git) C++ · 114 lines

48 if (Ok())

49 {

50 len = recv(m_handle, (void *)&tmp, sizeof(char), MSG_TRUNC | MSG_PEEK);

51 if (len < 0)

52 {

test1.c (https://gitlab.com/o1s2/selflrrn) C · 208 lines

33 #endif

34

35 #ifndef MSG_PEEK

36 printf("+ MSG_PEEK not defined\n");

socket.d (https://github.com/soywiz/pspemu.git) D · 670 lines

100 MSG_EOR

101 MSG_OOB

102 MSG_PEEK

103 MSG_TRUNC

104 MSG_WAITALL

251 MSG_EOR = 0x80,

252 MSG_OOB = 0x01,

253 MSG_PEEK = 0x02,

254 MSG_TRUNC = 0x20,

255 MSG_WAITALL = 0x100

401 MSG_EOR = 0x8,

402 MSG_OOB = 0x1,

403 MSG_PEEK = 0x2,

404 MSG_TRUNC = 0x10,

405 MSG_WAITALL = 0x40

sockets.md (https://github.com/vyzo/gerbil.git) Markdown · 581 lines

398 MSG_NOSIGNAL

399 MSG_OOB

400 MSG_PEEK

401 MSG_TRUNC

402 MSG_WAITALL

socket_util.c (https://bitbucket.org/freebsd/freebsd-base.git) C · 75 lines

55 /* The socket is readable - peek to see whether it returns EOF

56 * without consuming bytes from the socket buffer. */

57 rv = apr_socket_recvfrom(&unused, sock, MSG_PEEK, &buf, &len);

58 if (rv == APR_EOF) {

59 *atreadeof = 1;

socket.scm (https://code.google.com/p/sagittarius-scheme/) Scheme · 92 lines

61 SHUT_RDWR

62 MSG_OOB

63 MSG_PEEK

64 MSG_DONTROUTE

65 MSG_CTRUNC

LSOCK.cpp (https://bitbucket.org/oregon/oregoncore/) C++ · 184 lines ✨ Summary

This C++ code implements a Unix domain socket (UDS) class, ACE_LSOCK, which provides functions for sending and receiving file descriptors over a UDS connection. The send_handle function sends an open file descriptor to the peer, while the recv_handle function receives an open file descriptor from the peer. The code uses various operating system APIs, such as sendmsg and recvmsg, to implement these functions.

133 ssize_t nbytes = ACE_OS::recvmsg (this->get_handle (),

134 &recv_msg,

135 MSG_PEEK);

136

137 if (nbytes != ACE_INVALID_HANDLE)

142 {

143 #if defined (ACE_HAS_4_4BSD_SENDMSG_RECVMSG)

144 // Close down the socket that was returned by the MSG_PEEK.

145 cmsghdr *cmsgptr = (cmsghdr *) cmsgbuf;

146 ACE_HANDLE * ph = (ACE_HANDLE *) CMSG_DATA (cmsgptr);

network.c (https://bitbucket.org/amontero/tinyproxy.git) C · 238 lines

163 whole_buffer_len = 0;

164 for (;;) {

165 ret = recv(fd, buffer, SEGMENT_LEN, MSG_PEEK);

166 if (ret <= 0)

167 goto CLEANUP;

socket.d (https://github.com/fawzi/oldTango.git) D · 113 lines

100 MSG_EOR = 0x8,

101 MSG_OOB = 0x1,

102 MSG_PEEK = 0x2,

103 MSG_TRUNC = 0x10,

104 MSG_WAITALL = 0x40

sendrecv.c (https://github.com/colinbenner/ocaml-llvm.git) C · 141 lines

22

23 static int msg_flag_table[] = {

24 MSG_OOB, MSG_DONTROUTE, MSG_PEEK

25 };

26

linux_socket.h (https://github.com/okuoku/freebsd-head.git) C Header · 119 lines

35

36 #define LINUX_MSG_OOB 0x01

37 #define LINUX_MSG_PEEK 0x02

38 #define LINUX_MSG_DONTROUTE 0x04

39 #define LINUX_MSG_CTRUNC 0x08

sock.pyx (https://gitlab.com/lely_industries/io) Cython · 469 lines

11 IO_SOCK_DGRAM = _IO_SOCK_DGRAM

12

13 IO_MSG_PEEK = _IO_MSG_PEEK

14 IO_MSG_OOB = _IO_MSG_OOB

15 IO_MSG_WAITALL = _IO_MSG_WAITALL

udp_connection.cpp (https://github.com/nanomo/network-traffic-generator.git) C++ · 207 lines

103

104 rflag=PROTOCOL_NONE;

105 if (flags&PROTOCOL_PEEK) rflag|=MSG_PEEK;

106 #if defined(__WIN32__)

107 data[0]=0;

socket.d (https://github.com/mirrors/gcc.git) D · 1894 lines

127 MSG_EOR

128 MSG_OOB

129 MSG_PEEK

130 MSG_TRUNC

131 MSG_WAITALL

524 MSG_EOR = 0x80,

525 MSG_OOB = 0x01,

526 MSG_PEEK = 0x02,

527 MSG_TRUNC = 0x20,

528 MSG_WAITALL = 0x100,

667 MSG_EOR = 0x8,

668 MSG_OOB = 0x1,

669 MSG_PEEK = 0x2,

670 MSG_TRUNC = 0x10,

671 MSG_WAITALL = 0x40

_-select.c (https://github.com/MewX/Psiphon3-for-Linux.git) C · 297 lines

275 if( FD_ISSET(fd,&xfds) ){

276 if( isWindowsCE() ){

277 /* without MSG_PEEK, to set PS_PRI to show disconn. */

278 ev2 |= PS_PRI;

279 }else

286 char buf[1];

287 int rcc;

288 rcc = recv(fd,buf,1,MSG_PEEK|MSG_OOB);

289 syslog_DEBUG("---- PollInOuts(%d)PRI OOB=%d\n",fd,rcc);

290 if( 0 < rcc )

listener_filter_fuzzer.cc (https://github.com/envoyproxy/envoy.git) C++ · 124 lines

53 .WillRepeatedly(Invoke(

54 [&data](os_fd_t, void* buffer, size_t length, int flags) -> Api::SysCallSizeResult {

55 return data.read(buffer, length, flags == MSG_PEEK);

56 }));

57 }

loopudp.c (https://gitlab.com/peter__barnes/work) C · 210 lines

158

159 } else if (connectudp) {

160 /* msgpeek = 0 or MSG_PEEK */

161 flags = msgpeek;

162 oncemore:

IO.pm (https://github.com/dwimperl/perl-5.12.3.0.git) Perl · 261 lines

25 MORE:

26 for(

27 $peer = recv($_[0],$buf,$n,MSG_PEEK);

28 defined $peer;

29 $peer = recv($_[0],$buf,$n<<=1,MSG_PEEK)

77 # Check we can read the whole element

78 goto error

79 unless defined($peer = recv($_[0],$buf,$len,MSG_PEEK));

80

81 if ($len > length $buf) {

90 }

91

92 if ($_[2] & MSG_PEEK) {

93 $_[1] = substr($buf,0,$len);

94 }

common.cpp (https://github.com/silviu/quill.git) C++ · 236 lines

75 bool found = false;

76 while(!found) {

77 int rc = recv(fd, buf, BUF_SIZE, MSG_PEEK);

78 if (rc == -1) {

79 perros("recv peek");

socket.h (https://github.com/managarm/mlibc.git) C Header · 283 lines

260

261 #define MSG_OOB 0x0001

262 #define MSG_PEEK 0x0002

263 #define MSG_DONTROUTE 0x0004

264 #define MSG_CTRUNC 0x0008

sslinux.pas (http://transmisson-remote-gui.googlecode.com/svn/trunk/) Pascal · 1315 lines ✨ Summary

This is a set of functions for working with IPv6 addresses and networks in the Delphi programming language. It includes functions for converting between different representations of IPv6 addresses, such as text and binary, as well as functions for checking whether an address is within a given network or subnet.

365

366 MSG_OOB = $01; // Process out-of-band data.

367 MSG_PEEK = $02; // Peek at incoming messages.

368

369 const

SocketMessage.java (https://github.com/jnr/jnr-constants.git) Java · 50 lines

5 MSG_OOB(0x1L),

6 // MSG_DONTWAIT not defined

7 MSG_PEEK(0x2L),

8 MSG_DONTROUTE(0x4L),

9 // MSG_EOR not defined

37 java.util.Map<SocketMessage, String> map = new java.util.EnumMap<SocketMessage, String>(SocketMessage.class);

38 map.put(MSG_OOB, "MSG_OOB");

39 map.put(MSG_PEEK, "MSG_PEEK");

40 map.put(MSG_DONTROUTE, "MSG_DONTROUTE");

41 map.put(MSG_WAITALL, "MSG_WAITALL");

blackadder.cpp (https://github.com/tsilochr/blackadder.git) C++ · 278 lines

245 char *data;

246 char *buf;

247 total_buf_size = recv(sock_fd, fake_buf, 1, MSG_PEEK | MSG_TRUNC | MSG_WAITALL);

248 if (total_buf_size > 0) {

249 buf = (char *) malloc(total_buf_size);

msg.c (https://quake.svn.sourceforge.net/svnroot/quake) C · 382 lines

371

372 int

373 MSG_PeekByte (msg_t *msg)

374 {

375 int c;

posix.h (https://github.com/phoenix-rtos/phoenix-rtos-kernel.git) C Header · 182 lines

127 #define SOL_SOCKET 0xFFF

128

129 #define MSG_PEEK 0x01

130 #define MSG_WAITALL 0x02

131 #define MSG_OOB 0x04

Link.cpp (https://github.com/DOCGroup/ATCD.git) C++ · 330 lines

204 {

205 ACE_Time_Value t (params_.tick ());

206 ssize_t r = rsock_.recv (data, 4, addr, MSG_PEEK, &t);

207

208

ByteStringSpec.hs (git://github.com/haskell/network.git) Haskell · 308 lines

226 (_, msgs, _, _flags) <- recvMsg sock 1024 0 MSG_PEEK

227 -- flags .&. MSG_PEEK `shouldBe` MSG_PEEK -- Mac only

228 (_, msgs', _, _) <- recvMsg sock 1024 0 mempty

229 msgs `shouldBe` msgs'

socket.h (https://bitbucket.org/devzero2000/openvswitch.git) C Header · 133 lines

84 MSG_OOB,

85 MSG_NOSIGNAL,

86 MSG_PEEK,

87 MSG_TRUNC,

88 MSG_WAITALL,

clients.c (https://github.com/zcoder/netio.git) C · 410 lines

274 }

275

276 ssize_t recvsize = recv( set->fd, recvbuff, p_recvbuff, MSG_PEEK );

277 if ( recvsize == -1 )

278 {

socket_io.cpp (https://github.com/suhailsherif/MySQL-5.1-.git) C++ · 332 lines

84 {

85 int t;

86 while((t = recv(socket, ptr, len, MSG_PEEK)) == -1 && errno == EINTR);

87

88 if(t < 1)

SocketInProvider.h (https://github.com/nterman/nbites.git) C Header · 157 lines

137 }

138

139 if (recv(file_descriptor, buffer, size, MSG_PEEK) < 0) {

140 throw aio_read_exception(aio_read_exception::READ, errno);

141 }

datagram.c (https://github.com/tiwai/sound.git) C · 199 lines

120 int copylen;

121

122 if (flags & ~(MSG_PEEK|MSG_TRUNC|MSG_DONTWAIT|MSG_NOSIGNAL|

123 MSG_CMSG_COMPAT))

124 goto out_nofree;

send_spec.rb (https://github.com/abdollar/ruby.git) Ruby · 220 lines

45 t = Thread.new do

46 client = @server.accept

47 peek_data = client.recv(6, Socket::MSG_PEEK)

48 data = client.recv(6)

49 client.recv(10) # this recv is important

53 t.status.should_not be_nil

54

55 @socket.send('helloU', Socket::MSG_PEEK | Socket::MSG_OOB).should == 6

56 @socket.shutdown # indicate, that we are done sending

57

heartbleed_example.c (https://github.com/atxsinn3r/VulnCases.git) C · 159 lines

107 do {

108 // recv() will complete when the input ends with \r\d

109 bytesRead = recv(clientSocket, recvBuffer, recvBufferLen, MSG_PEEK);

110 if (bytesRead > 0) {

111 recvBuffer[bytesRead] = '\0';

protocol.c (https://bitbucket.org/JuantAldea/lut-2012-network-programming.git) C · 263 lines

37 {

38 int recv_bytes;

39 while ((recv_bytes = recv(socket, buffer, MAX_MSG_SIZE, MSG_PEEK)) > 0){

40 if (strchr(buffer, '\r') != NULL && strchr(buffer, '\n') != NULL){

41 int size = strchr(buffer, '\n') - buffer + 1;

ph.t (http://perl5005.googlecode.com/svn/trunk/) Perl · 97 lines

16 AF_INET AF_LAT AF_MAX AF_NBS AF_NIT AF_NS AF_OSI AF_OSINET AF_PUP

17 AF_SNA AF_UNIX AF_UNSPEC AF_X25 MSG_DONTROUTE MSG_MAXIOVLEN MSG_OOB

18 MSG_PEEK PF_802 PF_APPLETALK PF_CCITT PF_CHAOS PF_DATAKIT PF_DECnet PF_DLI

19 PF_ECMA PF_GOSIP PF_HYLINK PF_IMPLINK PF_INET PF_LAT PF_MAX PF_NBS PF_NIT

20 PF_NS PF_OSI PF_OSINET PF_PUP PF_SNA PF_UNIX PF_UNSPEC PF_X25 SOCK_DGRAM

net.c (https://github.com/ncsurobotics/svr.git) C · 146 lines

107 /* The first byte received should be the size of the message that follows

108 minus the header data */

109 n = SVR_Net_recv(socket, &message_length, sizeof(uint16_t), MSG_PEEK);

110

111 if(n <= 0) {

poll.cc (https://bitbucket.org/pizzafactory/binutils.git) C++ · 158 lines

108 if (FD_ISSET(fds[i].fd, read_fds))

109 /* This should be sufficient for sockets, too. Using

110 MSG_PEEK, as before, can be considered dangerous at

111 best. Quote from W. Richard Stevens: "The presence

112 of an error can be considered either normal data or

kernel_footprint.c (https://github.com/robots/APRS.git) C · 96 lines

80 msg_initPort(&in_port, event_createSignal(p, SIG_USER1));

81 msg_put(&in_port, &msg);

82 msg_peek(&in_port);

83 Msg *msg_re = msg_get(&in_port);

84 msg_reply(msg_re);

inet.c (https://gitlab.com/nobody-mb/minecraft-classic-old-bot) C · 174 lines

127 buffer = realloc(buffer, i);

128 while (a != i-1){

129 a = recv(stc, buffer+1, i-1, MSG_PEEK);

130 }

131 a = recv(stc, buffer+1, i-1, 0);

send_spec.rb (https://github.com/Hank923/ironruby.git) Ruby · 69 lines

37 t = Thread.new do

38 client = @server.accept

39 peek_data = client.recv(6, Socket::MSG_PEEK)

40 data = client.recv(6)

41 client.close

44 t.status.should_not be_nil

45

46 @socket.send('helloU', Socket::MSG_PEEK | Socket::MSG_OOB).should == 6

47

48 t.join

socket.h (https://github.com/shattered/linux-m68k.git) C Header · 147 lines

90 /* Flags we can use with send/ and recv. */

91 #define MSG_OOB 1

92 #define MSG_PEEK 2

93 #define MSG_DONTROUTE 4

94 /*#define MSG_CTRUNC 8 - We need to support this for BSD oddments */

receive-data-from-socket.md (https://github.com/huy/linux_kernel_study.git) Markdown · 147 lines

100

101

102 if (flags & MSG_PEEK) {

103 spin_lock_irqsave(&sk->sk_receive_queue.lock,

104 cpu_flags);

getpeereid.c (https://bitbucket.org/devzero2000/openldap.git) C · 220 lines

135 /*

136 * AIX returns a bogus file descriptor if recvmsg() is

137 * called with MSG_PEEK (is this a bug?). Hence we need

138 * to receive the Abandon PDU.

139 */

connection.c (https://github.com/q3k/uhub.git) C · 328 lines

211 ssize_t net_con_peek(struct net_connection* con, void* buf, size_t len)

212 {

213 int ret = net_recv(con->sd, buf, len, MSG_PEEK);

214 if (ret == -1)

215 {

SocketSerialized.cpp (https://github.com/Krozark/cpp-Socket.git) C++ · 373 lines

288 else

289 {

290 res = init_receive(&size,MSG_PEEK);

291 if(res > 0 and size>0)

292 {

327 else

328 {

329 res = init_receive(&size,MSG_PEEK);

330 if(res > 0 and size>0)

331 {

glibconfig.h (https://github.com/SLIBIO/SLib.git) C Header · 212 lines

205

206 #define GLIB_SYSDEF_MSG_OOB 1

207 #define GLIB_SYSDEF_MSG_PEEK 2

208 #define GLIB_SYSDEF_MSG_DONTROUTE 4

209

websocketproxy.py (https://github.com/bcwaldon/nova.git) Python · 95 lines

73 connect_info['internal_access_path'])

74 while True:

75 data = tsock.recv(4096, socket.MSG_PEEK)

76 if data.find("\r\n\r\n") != -1:

77 if not data.split("\r\n")[0].find("200"):

SSL_SOCK_Stream.inl (https://gitlab.com/mohsencs/SunWellCore) C++ Header · 364 lines

121 if (flags)

122 {

123 if (ACE_BIT_ENABLED (flags, MSG_PEEK))

124 {

125 peeking = true;

socket.h (https://gitlab.com/abidin24/sortix) C Header · 189 lines

136 #define MSG_OOB (1<<3)

137 #define MSG_NOSIGNAL (1<<4)

138 #define MSG_PEEK (1<<5)

139 #define MSG_TRUNC (1<<6)

140 #define MSG_WAITALL (1<<7)

socket.d (https://github.com/wolfwood/djehuty.git) D · 300 lines

258 ulong SocketReadAvailable(ref SocketPlatformVars sockVars, ubyte* buffer, ulong len)

259 {

260 //ulong total = recv(sockVars.m_skt, null, 0, MSG_PEEK);

261

262 //if (total == 0) { return 0; }

socket.c (https://github.com/scala-native/scala-native.git) C · 203 lines

72 }

73

74 int scalanative_MSG_PEEK() { return MSG_PEEK; }

75

76 int scalanative_MSG_TRUNC() { return MSG_TRUNC; }

AsyncFile.py (git://pkgs.fedoraproject.org/eric) Python · 296 lines

177 # delivered as two separate events. Therefore we make sure we only

178 # read a line at a time.

179 line = self.sock.recv(size, socket.MSG_PEEK)

180

181 eol = line.find(b'\n')

web.py (https://github.com/paraboul/noVNC.git) Python · 53 lines

30 try:

31 newsocket, from_addr = bindsocket.accept()

32 peek = newsocket.recv(1024, socket.MSG_PEEK)

33 if peek.startswith("\x16"):

34 connstream = ssl.wrap_socket(

socket_non_stream.cc (https://github.com/google/gvisor.git) C++ · 337 lines

137 memset(received_data, 0, sizeof(received_data));

138 ASSERT_THAT(RetryEINTR(recv)(sockets->second_fd(), received_data,

139 sizeof(received_data), MSG_PEEK),

140 SyscallSucceedsWithValue(sizeof(sent_data1)));

141 EXPECT_EQ(0, memcmp(sent_data1, received_data, sizeof(sent_data1)));

255 }

256

257 // This test tests reading from a socket with MSG_TRUNC | MSG_PEEK and a zero

258 // length receive buffer. The user should be able to get the message length

259 // without reading data off the socket.

280 // The syscall succeeds returning the full size of the message on the socket.

281 ASSERT_THAT(RetryEINTR(recvmsg)(sockets->second_fd(), &peek_msg,

282 MSG_TRUNC | MSG_PEEK),

283 SyscallSucceedsWithValue(sizeof(sent_data)));

284

test_websocketproxy.py (https://github.com/SiggyBar/emscripten.git) Python · 136 lines

45 def recv(self, amt, flags=None):

46 res = self._data[0:amt]

47 if not (flags & socket.MSG_PEEK):

48 self._data = self._data[amt:]

49

sockets.constants.html (https://github.com/cue-taro/emacs-setting-files.git) HTML · 2766 lines

174

175 <span class="term">

176 <b><tt>MSG_PEEK</tt></b>

177 (<span class="type"><a href="language.types.integer.html" class="type integer">integer</a></span>)

178 </span>

SOCKET.py (https://bitbucket.org/__wp__/mb-linux-msli.git) Python · 145 lines

119 SOMAXCONN = 5

120 MSG_OOB = 0x1

121 MSG_PEEK = 0x2

122 MSG_DONTROUTE = 0x4

123 MSG_MAXIOVLEN = 16

ENServer.cpp (https://github.com/brucetsao/86Duino.git) C++ · 227 lines

186 uint8_t val;

187

188 if (recv(Clients[j]._sock, &val, 1, MSG_PEEK) <= 0)

189 Clients[j].stop();

190

udp.cpp (https://github.com/MaxBelkov/visualsyslog.git) C++ · 633 lines

362 }

363

364 bytes = recv(handle, (char *)data, size, bPeek ? MSG_PEEK : 0);

365 if( bytes == SOCKET_ERROR )

366 {

448

449 int fromlen = sizeof(struct sockaddr);

450 bytes = recvfrom(handle, (char *)data, size, bPeek ? MSG_PEEK : 0, p, &fromlen);

451 if( bytes==SOCKET_ERROR )

452 {

socket_wrapper.cpp (https://gitlab.com/envieidoc/tomato) C++ · 208 lines

164 {

165 byte b;

166 return receive(&b, 1, MSG_PEEK) != static_cast<uint>(-1);

167 }

168

netwrap_socket.c (https://github.com/OpenFastPath/ofp.git) C · 676 lines

604 if (flags & MSG_OOB)

605 ofp_flags |= OFP_MSG_OOB;

606 if (flags & MSG_PEEK)

607 ofp_flags |= OFP_MSG_PEEK;

hev-socks5-session-udp.c (https://github.com/heiher/hev-socks5-tproxy.git) C · 302 lines

92 }

93

94 res = recv (fd, buf, 1, MSG_PEEK);

95 if (res <= 0) {

96 if ((res < 0) && (errno == EAGAIN))

constants_spec.rb (https://github.com/benburkert/rubyspec.git) Ruby · 64 lines

26

27 it "defines send/receive options" do

28 consts = ["MSG_DONTROUTE", "MSG_OOB", "MSG_PEEK"]

29 consts.each do |c|

30 Socket::Constants.should have_constant(c)

checkSock.cpp (https://github.com/ALTIBASE/altibase.git) C++ · 53 lines

34 #if !defined(CM_DISABLE_TCP) || !defined(CM_DISABLE_UNIX)

35

36 #if defined(MSG_PEEK)

37 CHECK(MSG_PEEK != 0);

conn.go (https://github.com/snapcore/snapd.git) Go · 175 lines

64 for {

65 // Just read how many bytes are available in the socket

66 if n, _, err = syscall.Recvfrom(c.Fd, buf, syscall.MSG_PEEK); err != nil {

67 return

68 }

mod.rs (https://github.com/chromium/chromium.git) Rust · 103 lines

78

79 pub const MSG_OOB: ::c_int = 0x04;

80 pub const MSG_PEEK: ::c_int = 0x01;

81 pub const MSG_DONTWAIT: ::c_int = 0x08;

82 pub const MSG_DONTROUTE: ::c_int = 0x4;

Makefile.PL (https://bitbucket.org/__wp__/mb-linux-msli.git) Perl · 68 lines

55 macro=>["#if defined($_) || defined(HAS_$_) /* might be an enum */\n",

56 "#endif\n"]}

57 foreach qw (MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS);

58

59 push @names,

socket.h (https://github.com/bigboss-ps3dev/PSL1GHT.git) C Header · 121 lines

68

69 #define MSG_OOB 0x0001

70 #define MSG_PEEK 0x0002

71 #define MSG_DONTROUTE 0x0004

72 #define MSG_EOR 0x0008

TCPSocket.cpp (https://github.com/necrophcodr/Passion.git) C++ · 146 lines

139 if ( select( m_socket + 1, &set, 0, 0, &time ) > 0 ) {

140 char temp;

141 return recv( m_socket, &temp, 1, MSG_PEEK ) == 1;

142 } else {

143 return 0;

vp_com_socket_utils.c (https://bitbucket.org/enddl22/ardrone_side_project.git) C · 223 lines

160

161 /* Query packet size */

162 available = recvfrom(s, (char*)local_buffer,0, MSG_PEEK|MSG_TRUNC, (struct sockaddr*)&from, &fromlen);

163

164 /* Resize the buffer */

SOCKET.py (https://bitbucket.org/__wp__/mb-linux-msli.git) Python · 93 lines

83 UIO_SMALLIOV = 8

84 MSG_OOB = 0x1

85 MSG_PEEK = 0x2

86 MSG_DONTROUTE = 0x4

87 MSG_EOR = 0x8

peek.c (https://github.com/rillian/firefox.git) C · 360 lines

5

6 /*

7 * A test case for the PR_MSG_PEEK flag of PR_Recv().

8 *

9 * Test both blocking and non-blocking sockets.

54 memset(buf, 0, sizeof(buf));

55 nbytes = PR_Recv(sock, buf, recv_amount[i],

56 PR_MSG_PEEK, PR_INTERVAL_NO_TIMEOUT);

57 if (-1 == nbytes) {

58 fprintf(stderr, "PR_Recv failed\n");

74 memset(buf, 0, sizeof(buf));

75 nbytes = PR_Recv(sock, buf, recv_amount[i],

76 PR_MSG_PEEK, PR_INTERVAL_NO_TIMEOUT);

77 if (-1 == nbytes) {

78 fprintf(stderr, "PR_Recv failed\n");

WinThread_Client.cpp (http://sandblastplanning.googlecode.com/svn/trunk/) C++ · 90 lines

71 while (strlen(RecvBuff)<29)

72 {

73 CliSock.Receive(&RecvBuff,30,MSG_PEEK);

74 }

75 CliSock.Receive(&RecvBuffCli,30);

SOCKET.py (https://github.com/swolchok/dspython.git) Python · 106 lines

82 SOMAXCONN = 5

83 MSG_OOB = 0x1

84 MSG_PEEK = 0x2

85 MSG_DONTROUTE = 0x4

86 MSG_EOR = 0x8

sockets-constants.ads (https://github.com/samueltardieu/adasockets.git) Ada · 84 lines

53 Ip_Drop_Membership : constant := 16#000D#;

54 O_Nonblock : constant := 16#20000#;

55 Msg_Peek : constant := 16#0002#;

56 Fionbio : constant := -2147195266;

57 Fionread : constant := 16#4004667F#;

recvfrom_spec.rb (https://github.com/zenspider/ruby.git) Ruby · 123 lines

99 @client.write('hello')

100

101 @server.recvfrom(2, Socket::MSG_PEEK)[0].should == 'he'

102

103 @server.recvfrom(2)[0].should == 'he'

message_flags.hpp (git://github.com/dietmarkuehl/kuhllib.git) C++ Header · 74 lines

35 namespace nstd::hidden_names {

36 enum class message_flags: unsigned int {

37 peek = MSG_PEEK,

38 out_of_band = MSG_OOB,

39 do_not_route = MSG_DONTROUTE

routineutil.cpp (https://github.com/tencent-wechat/phxsql.git) C++ · 157 lines

146

147 if (pf[0].revents & POLLIN) {

148 return recv(source_fd, buf, buf_size, MSG_PEEK);

149 } else if (pf[0].revents & POLLHUP) {

150 return return_fd_count;

socket.scala (https://github.com/scala-native/scala-native.git) Scala · 238 lines

112 def MSG_NOSIGNAL: CInt = extern // returns 0 on macOS

113

114 @name("scalanative_MSG_PEEK")

115 def MSG_PEEK: CInt = extern

http.c (https://github.com/itanko/last.fm-lib.git) C · 207 lines

109 *buff = 0;

110 for(;;) {

111 recvd = recv(sock, buff, 1024, MSG_PEEK);

112 if((recvd != 0 ) & (recvd != -1)) break;

113 recvd = errno;

cups-2.0.2-poll-CPU-loop-STR-4605.patch (https://gitlab.com/rindeal/gentoo-cvs-history-archive) Patch · 48 lines

20 */

21

22 + if (!httpGetReady(con->http) && recv(httpGetFd(con->http), buf, 1, MSG_PEEK) < 1)

23 + {

24 + /*

socket.h (https://github.com/freemint/freemint.git) C Header · 112 lines

62 /* flags for send and recv */

63 # define MSG_OOB 1

64 # define MSG_PEEK 2

65 # define MSG_DONTROUTE 4

66

ecore_audio_pulse_ml.c (https://github.com/Enlightenment/efl.git) C · 355 lines

57

58 /* Check for HUP and report */

59 if (recv(fd, buf, 64, MSG_PEEK))

60 {

61 if (errno == ESHUTDOWN || errno == ECONNRESET || errno == ECONNABORTED || errno == ENETRESET)

socket.h (https://repo.or.cz/AquilaOS.git) C Header · 85 lines

61 #define MSG_OOB 0x0008

62 #define MSG_NOSIGNAL 0x0010

63 #define MSG_PEEK 0x0020

64 #define MSG_TRUNC 0x0040

65 #define MSG_WAITALL 0x0080

ngx_http_php_keepalive.c (https://github.com/rryqszq4/ngx_php7.git) C · 219 lines

185 }

186

187 n = recv(c->fd, buf, 1, MSG_PEEK);

188

189 if (n == -1 && ngx_socket_errno == NGX_EAGAIN) {

send_spec.rb (https://github.com/bjeanes/rubyspec.git) Ruby · 82 lines

43 t = Thread.new do

44 client = @server.accept

45 peek_data = client.recv(6, Socket::MSG_PEEK)

46 data = client.recv(6)

47 client.recv(10) # this recv is important

51 t.status.should_not be_nil

52

53 @socket.send('helloU', Socket::MSG_PEEK | Socket::MSG_OOB).should == 6

54 @socket.shutdown # indicate, that we are done sending

55