2011 Embedded Systems Software Training Center BluRapport SDK.

Slides:



Advertisements
Similar presentations
Socket Programming 101 Vivek Ramachandran.
Advertisements

Introduction to Sockets Jan Why do we need sockets? Provides an abstraction for interprocess communication.
CS 4700 / CS 5700 Network Fundamentals
Computer Net Lab/Praktikum Datenverarbeitung 2 1 Overview Sockets Sockets in C Sockets in Delphi.
CSE 333 – SECTION 8 Networking and sockets. Overview Network Sockets IP addresses and IP address structures in C/C++ DNS – Resolving DNS names Demos.
© Janice Regan, CMPT 128, CMPT 371 Data Communications and Networking Socket Programming 0.
Network Programming Chapter 11 Lecture 6. Networks.
Elementary TCP Sockets Chapter 4 UNIX Network Programming Vol. 1, Second Ed. Stevens.
Socket Programming.
1 Java Networking – Part I CS , Spring 2008/9.
Tutorial 8 Socket Programming
Java Socket Support Presentation by: Lijun Yuan Course Number: cs616.
Sockets COS 518: Advanced Computer Systems Michael Freedman Fall
CS 360 – Spring 2007 Pacific University TCP section 6.5 (Read this section!) 27 Feb 2007.
UNIX Sockets COS 461 Precept 1. Clients and Servers Client program – Running on end host – Requests service – E.g., Web browser Server program – Running.
UNIX Sockets COS 461 Precept 1.
2011 Embedded Systems Software Training Center BluRapport SDK.
Sockets CIS 370 Fall 2009, UMassD. Introduction  Sockets provide a simple programming interface which is consistent for processes on the same machine.
ECE 4110 – Internetwork Programming Client-Server Model.
Sockets and intro to IO multiplexing. Goals We are going to study sockets programming as means to introduce IO multiplexing problem. We will revisit socket.
Network Programming Tutorial #9 CPSC 261. A socket is one end of a virtual communication channel Provides network connectivity to any other socket anywhere.
2011 Embedded Systems Software Training Center BluRapport SDK.
Fall 2000Datacom 11 Lecture 4 Socket Interface Programming: Service Interface between Applications and TCP.
IT1352-NETWORK PROGRAMMING AND MANAGEMENT
LWIP TCP/IP Stack 김백규.
Jozef Goetz, Application Layer PART VI Jozef Goetz, Position of application layer The application layer enables the user, whether human.
Server Sockets: A server socket listens on a given port Many different clients may be connecting to that port Ideally, you would like a separate file descriptor.
 Wind River Systems, Inc Chapter - 13 Network Programming.
Dr. John P. Abraham Professor University of Texas Pan American Internet Applications and Network Programming.
Inter-process communication: Socket. socket Internet socket From Wikipedia, the free encyclopedia Jump to: navigation,
---- IT Acumens. COM IT Acumens. COMIT Acumens. COM.
Chapter 2 Applications and Layered Architectures Sockets.
The Socket Interface Chapter 21. Application Program Interface (API) Interface used between application programs and TCP/IP protocols Interface used between.
The Socket Interface Chapter 22. Introduction This chapter reviews one example of an Application Program Interface (API) which is the interface between.
Remote Shell CS230 Project #4 Assigned : Due date :
L 2 - 1 3( 1/ 20) : Java Network Programming. The Socket API The previous contents describe client-server interaction that application programs use when.
Socket Programming Using JAVA Asma Shakil Semester 1, 2008/2009.
CPSC 441 TUTORIAL – FEB 13, 2012 TA: RUITNG ZHOU UDP REVIEW.
UNIX Sockets COS 461 Precept 1. Socket and Process Communication The interface that the OS provides to its networking subsystem application layer transport.
Introduction to Socket
Socket Programming Lab 1 1CS Computer Networks.
The Client-Server Model And the Socket API. Client-Server (1) The datagram service does not require cooperation between the peer applications but such.
CSCI 330 UNIX and Network Programming Unit XV: Transmission Control Protocol.
S OCKET P ROGRAMMING IN C Professor: Dr. Shu-Ching Chen TA: HsinYu Ha.
S OCKET P ROGRAMMING IN C Professor: Dr. Shu-Ching Chen TA: Hsin-Yu Ha.
Review: – Why layer architecture? – peer entities – Protocol and service interface – Connection-oriented/connectionless service – Reliable/unreliable service.
CSCI 330 UNIX and Network Programming Unit XIV: User Datagram Protocol.
Socket Programming. Computer Science, FSU2 Interprocess Communication Within a single system – Pipes, FIFOs – Message Queues – Semaphores, Shared Memory.
1 Spring Semester 2008, Dept. of Computer Science, Technion Internet Networking recitation #7 Socket Programming.
1 TCP Sockets Programming Creating a passive mode (server) socket.Creating a passive mode (server) socket. Establishing an application-level connection.Establishing.
Agenda Socket Programming The OSI reference Model The OSI protocol stack Sockets Ports Java classes for sockets Input stream and.
Lecture 3 TCP and UDP Sockets CPE 401 / 601 Computer Network Systems slides are modified from Dave Hollinger.
1 K. Salah Application Layer Module K. Salah Network layer duties.
1 Socket Interface. 2 Client-Server Architecture The client is the one who speaks first Typical client-server situations  Client and server on the same.
Socket Programming(1/2). Outline  1. Introduction to Network Programming  2. Network Architecture – Client/Server Model  3. TCP Socket Programming.
1 Socket Interface. 2 Basic Sockets API Review Socket Library TCPUDP IP EthernetPPP ARP DHCP, Mail, WWW, TELNET, FTP... Network cardCom Layer 4 / Transport.
Netprog: TCP Sockets1 TCP Sockets Programming Creating a passive mode (server) socket.Creating a passive mode (server) socket. Establishing an application-level.
SOCKET PROGRAMMING Presented By : Divya Sharma.
Object-Orientated Analysis, Design and Programming
Socket Programming Client/Server.
CSCE 313 Network Socket MP8 DUE: FRI MAY 5, 2017
Sockets and Beginning Network Programming
UNIX Sockets COS 461 Precept 1.
Chapter 3 Internet Applications and Network Programming
Socket Programming in C
Socket Programming in C
TCP Sockets Programming
Short-Range Radio Frequency Networking
Short-Range Radio Frequency Networking
Internet Networking recitation #8
Presentation transcript:

2011 Embedded Systems Software Training Center BluRapport SDK

Agenda Introduce to Low Level socket based layer of RXBT

Questions l What difference between protocol and profile? l Why we need to use profiles?

Socket based layer Sockets overview A RXBT socket is an endpoint of an inter-process communication flow across a Bluetooth network. Most communication between devices is based on the Bluetooth protocol stack. A socket API is an application programming interface (API), provided by RXBT SDK, that allows application programs to control and use bluetooth sockets. A socket address is the combination of an BDA address and type of protocol, much like one end of a telephone connection is the combination of a phone number and a particular extension. Based on this address, RXBT sockets deliver incoming data packets to the appropriate application process or thread Communicating local and remote sockets are called socket pairs. Each socket pair is described by a unique 6-tuple consisting of source and destination BDA addresses and port numbers, i.e. of local and remote socket addresses.

Socket SDK Main Functions that are used to work with Low Level socket API: rx_socket_t rx_socket(rx_socktype_t type, rx_sockproto_t protocol) - Create new socket -type - socket type (either stream or seqpacket) -protocol - Bluetooth protocol (it can be: RX_PF_HCI, RX_PF_L2CAP, RX_PF_RFCOMM, RX_PF_OBEX, RX_PF_SDP and etc.) returns socket ID (>= 0) if ok, error code (< 0) in case of error. rx_ret_t rx_close(rx_socket_t sock) – Close socket -sock - socket created by rx_socket() call typedef struct rx_sockaddr_s (more information about type of addresses and type of protocols see in rx_sdk.h) { rx_sockproto_t proto; union __protocol_u { rx_sockaddr_hci_t hci; rx_sockaddr_l2cap_t l2cap; rx_sockaddr_rfcomm_t rfcomm; rx_sockaddr_sdp_t sdp; rx_sockaddr_sco_t sco; rx_sockaddr_bnep_t bnep; } protocol; } rx_sockaddr_t;

Socket SDK Main Functions that are used to work with Low Level socket API: rx_ret_t rx_bind(rx_socket_t sock, rx_sockaddr_t *my_addr) - Bind local socket to some address -sock - socket to bind -my_addr – address NOTE: Bind local socket to some address. For different socket types different address components are used. In general, BDA will be ignored but PSM or channel # will be taken into account. If PSM or channel # is busy, RET_ALREADY_EXISTS is returned. It is strictly necessary to call rx_bind before rx_listen, but not before rx_connect.

Socket SDK Main Functions that are used to work with Low Level socket API: rx_ret_t rx_listen(rx_socket_t sock, int backlog) - Register socket as waiting for connections. -sock - socket to listen on. -backlog - incoming connections queue size (currently ignored) NOTE: The socket must not be used for other i/o before. rx_bind must be called before rx_listen. It is impossible to call rx_listen on HCI socket.

Socket SDK Main Functions that are used to work with Low Level socket API: rx_socket_t rx_accept(rx_socket_t sock, rx_sockaddr_t *addr) - Accept incoming connection. -sock - socket listening on. -addr - peer's address Returns new socket ID (>= 0) or error code (< 0). NOTE: Block if no ready incoming connections on this socket. rx_listen must be run once before rx_accept. It is impossible to call rx_accept on HCI socket.

Socket SDK Main Functions that are used to work with Low Level socket API: rx_ret_t rx_connect(rx_socket_t sock, rx_sockaddr_t *dest_addr) - Connect to the destination. -sock - socket to use -dest_addr - destination address (BDA and PSM or channel # must be filled) NOTE: Connect to the peer, blocking until connection complete. It is impossible to call rx_connect on HCI socket.

Socket SDK Main Functions that are used to work with Low Level socket API: rx_ret_t rx_read(rx_socket_t sock, void *buf, unsigned len) - Read data from the peer. -sock - socket ID -buf - user's buffer -len - buffer size Rreturns number of bytes read (> 0), or 0 in case of connection break, or error code (< 0) NOTE: -Blocking if no data ready. -If socket is in STREAM mode, can aither break or glue packets. -If socket is in SEQPACKET mode, return exactly packet size. If buffer length is less then packet size, packet rest will be returned on the next rx_read or rx_recv call. -rx_read and rx_recv calls can be mixed, but only one thread can call rx_read/rx_recv at the same time. -It is impossible to call rx_read on HCI socket.

Socket SDK Main Functions that are used to work with Low Level socket API: rx_ret_t rx_write(rx_socket_t sock, void *buf, unsigned len) - Send data to the peer. -sock - socket ID -buf - user buffer -len - data length Returns number of bytes written (> 0), or 0 in case of connection break, or error code (< 0) NOTE: -Try to send as much data as possible, but does not guarantee that all data will be send.

Socket SDK Main Functions that are used to work with Low Level socket API: rx_ret_t rx_getsockopt(rx_socket_t sock, int level, int optname, void *optval, unsigned *optlen) - Get either protocol or socket-level option. -sock - socket ID -[in] level - RX_SOL_SOCKET or RX_SOL_PROTO -[in] optname - either option from rx_sockopt_name_t or protocol-specific option. -[out] optval - user buffer; -[in,out] optlen - in: *optlen - buffer length; out: real number of bytes read. NOTE: -This call can't block. -This call can't be called at the same time with rx_read call.

Socket SDK Main Functions that are used to work with Low Level socket API: rx_ret_t rx_setsockopt(rx_socket_t sock, int level, int optname, void *optval, unsigned optlen) - Set either protocol or socket-level option. -sock - socket ID -level - RX_SOL_SOCKET or RX_SOL_PROTO -optname - either option from rx_sockopt_name_t or protocol-specific option. -optval - user buffer; -optlen - optlen - buffer length. NOTE: -This call can't block. -This call can't be called at the same time with rx_write call.

Socket SDK Main Functions that are used to work with Low Level socket API: rx_ret_t rx_getsockname(rx_socket_t sock, rx_sockaddr_t *addr) - Get local socket address. -sock - socket ID -addr - address NOTE: -Valid after rx_bind(), rx_listen(), rx_connect() calls. -Never blocks. rx_ret_t rx_getpeername(rx_socket_t sock, rx_sockaddr_t *addr) - Get remote address. -sock - socket ID -addr - address NOTE: -Valid after rx_accept(), rx_connect() calls. -Never blocks.

Socket SDK Main Functions that are used to work with Low Level socket API: rx_ret_t rx_ioctl(rx_socket_t sock, int name, void *arg_val, unsigned arg_size, void *ret_val, unsigned ret_buf_size, unsigned *ret_len) - Do protocol-specific action. -sock - socket ID -name - protocol-specific call ID -arg_val - IN argument value -arg_size - IN argument size -ret_val - result value -ret_buf_size - result buffer size -ret_len - real result length Returns a Error code NOTE: -This is low-level function used to to some protocol-specific thing. -It can block. -Only one rx_ioctl can be callse on the same socket an the same time..

Socket SDK Main Functions that are used to work with Low Level socket API: Example of using IOCTL rx_ret_t rx_rfcomm_sent_fcoff(rx_socket_t sock, rx_bool_t fcoff) { rx_ret_t ret = RET_OK; if (fcoff) { ret = rx_ioctl(sock, RFCOMM_IOCTL_SENT_FCOFF, 0,0,0,0,0); } else { ret = rx_ioctl(sock, RFCOMM_IOCTL_SENT_FCON, 0,0,0,0,0); } return ret; }

Socket SDK Main Functions that are used to work with Low Level socket API: Example of using IOCTL rx_ret_t rx_rfcomm_sent_test(rx_socket_t sock) { rx_ret_t ret = RET_OK; ret = rx_ioctl(sock, RFCOMM_IOCTL_SENT_TEST, 0,0, 0,0,0); return ret; }

THANK YOU