Lines Matching refs:socket

5     socket::{raw, tcp, udp},
142 let socket = raw::Socket::new( in new() localVariable
150 let handle: GlobalSocketHandle = GlobalSocketHandle::new(SOCKET_SET.lock().add(socket)); in new()
166 let socket = socket_set_guard.get_mut::<raw::Socket>(self.handle.0); in read() localVariable
168 match socket.recv_slice(buf) { in read()
179 Err(smoltcp::socket::raw::RecvError::Exhausted) => { in read()
186 drop(socket); in read()
196 let socket = socket_set_guard.get_mut::<raw::Socket>(self.handle.0); in write() localVariable
197 match socket.send_slice(buf) { in write()
201 Err(smoltcp::socket::raw::SendError::BufferFull) => { in write()
210 let socket: &mut raw::Socket = in write() localVariable
240 packet.set_next_header(socket.ip_protocol().into()); in write()
250 socket.send_slice(&buffer).unwrap(); in write()
252 drop(socket); in write()
315 let socket = udp::Socket::new(tx_buffer, rx_buffer); in new() localVariable
318 let handle: GlobalSocketHandle = GlobalSocketHandle::new(SOCKET_SET.lock().add(socket)); in new()
327 fn do_bind(&self, socket: &mut udp::Socket, endpoint: Endpoint) -> Result<(), SystemError> { in do_bind()
330 socket.bind(ip.port) in do_bind()
332 socket.bind(ip) in do_bind()
352 let socket = socket_set_guard.get_mut::<udp::Socket>(self.handle.0); in read() localVariable
356 if socket.can_recv() { in read()
357 if let Ok((size, remote_endpoint)) = socket.recv_slice(buf) { in read()
358 drop(socket); in read()
367 drop(socket); in read()
387 let socket = socket_set_guard.get_mut::<udp::Socket>(self.handle.0); in write() localVariable
390 if socket.endpoint().port == 0 { in write()
406 self.do_bind(socket, local_ep)?; in write()
409 if socket.can_send() { in write()
411 match socket.send_slice(&buf, *remote_endpoint) { in write()
414 drop(socket); in write()
432 let socket = sockets.get_mut::<udp::Socket>(self.handle.0); in bind() localVariable
434 return self.do_bind(socket, endpoint); in bind()
439 let socket = sockets.get::<udp::Socket>(self.handle.0); in poll() localVariable
441 return (socket.can_send(), socket.can_recv(), false); in poll()
473 let socket = sockets.get::<udp::Socket>(self.handle.0); in endpoint() localVariable
474 let listen_endpoint = socket.endpoint(); in endpoint()
525 let socket = tcp::Socket::new(tx_buffer, rx_buffer); in new() localVariable
528 let handle: GlobalSocketHandle = GlobalSocketHandle::new(SOCKET_SET.lock().add(socket)); in new()
539 socket: &mut smoltcp::socket::tcp::Socket, in do_listen()
544 socket.listen(local_endpoint.port) in do_listen()
547 socket.listen(local_endpoint) in do_listen()
572 let socket = socket_set_guard.get_mut::<tcp::Socket>(self.handle.0); in read() localVariable
575 if !socket.is_active() { in read()
580 if socket.may_recv() { in read()
581 let recv_res = socket.recv_slice(buf); in read()
585 let endpoint = if let Some(p) = socket.remote_endpoint() { in read()
591 drop(socket); in read()
611 drop(socket); in read()
619 let socket = socket_set_guard.get_mut::<tcp::Socket>(self.handle.0); in write() localVariable
621 if socket.is_open() { in write()
622 if socket.can_send() { in write()
623 match socket.send_slice(buf) { in write()
625 drop(socket); in write()
645 let socket = socket_set_guard.get_mut::<tcp::Socket>(self.handle.0); in poll() localVariable
650 if self.is_listening && socket.is_active() { in poll()
652 } else if !socket.is_open() { in poll()
655 if socket.may_recv() { in poll()
658 if socket.can_send() { in poll()
668 let socket = sockets.get_mut::<tcp::Socket>(self.handle.0); in connect() localVariable
677 match socket.connect(&mut inner_iface.context(), ip, temp_port) { in connect()
682 drop(socket); in connect()
687 let socket = sockets.get_mut::<tcp::Socket>(self.handle.0); in connect() localVariable
689 match socket.state() { in connect()
694 drop(socket); in connect()
727 let socket = sockets.get_mut::<tcp::Socket>(self.handle.0); in listen() localVariable
729 if socket.is_listening() { in listen()
734 return self.do_listen(socket, local_endpoint); in listen()
752 let socket = sockets.get_mut::<tcp::Socket>(self.handle.0); in shutdown() localVariable
753 socket.close(); in shutdown()
765 let socket = sockets.get_mut::<tcp::Socket>(self.handle.0); in accept() localVariable
767 if socket.is_active() { in accept()
769 let remote_ep = socket.remote_endpoint().ok_or(SystemError::ENOTCONN)?; in accept()
770 drop(socket); in accept()
801 drop(socket); in accept()
813 let socket = sockets.get::<tcp::Socket>(self.handle.0); in endpoint() localVariable
814 if let Some(ep) = socket.local_endpoint() { in endpoint()
823 let socket = sockets.get::<tcp::Socket>(self.handle.0); in peer_endpoint() localVariable
824 return socket.remote_endpoint().map(|x| Endpoint::Ip(Some(x))); in peer_endpoint()
992 pub fn new(socket: Box<dyn Socket>) -> Arc<Self> { in new()
993 return Arc::new(Self(SpinLock::new(socket))); in new()