1 Unix Domain Protocols when client and server are on the same host Unix domain socket address structure Socket functions Stream client-server Datagram.

Slides:



Advertisements
Similar presentations
Sockets: Network IPC Internet Socket UNIX Domain Socket.
Advertisements

Today’s topic: Basic TCP API –Socket –Bind –Listen –Connect –Accept –Read –Write –Close.
Socket Programming Application Programming Interface.
Computer Network Programming
Networks: TCP/IP Socket Calls1 Elementary TCP Sockets Chapter 4 UNIX Network Programming Vol. 1, Second Ed. Stevens.
Elementary TCP Sockets Chapter 4 UNIX Network Programming Vol. 1, Second Ed. Stevens.
Sockets Basics Conectionless Protocol. Today IPC Sockets Basic functions Handed code Q & A.
Tutorial 8 Socket Programming
Programming with Berkeley Sockets Presented by Chris GauthierDickey Written by Daniel Stutzbach (I think!) for CIS 432/532 Useful References: ● man pages.
CS 311 – Lecture 18 Outline IPC via Sockets – Server side socket() bind() accept() listen() – Client side connect() Lecture 181CS Operating Systems.
CSE/EE 461 Getting Started with Networking. Basic Concepts  A PROCESS is an executing program somewhere.  Eg, “./a.out”  A MESSAGE contains information.
Client Server Model The client machine (or the client process) makes the request for some resource or service, and the server machine (the server process)
Basic Socket Programming TCP/IP overview. TCP interface Reference: –UNIX Network Programming, by Richard Stevens. –UNIX man page.
Socket programming in C. Socket programming Socket API introduced in BSD4.1 UNIX, 1981 explicitly created, used, released by apps client/server paradigm.
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.
1 Networking (Stack and Sockets API). 2 Topic Overview Introduction –Protocol Models –Linux Kernel Support TCP/IP Sockets –Usage –Attributes –Example.
TCP/IP Protocol Stack IP Device Drivers TCPUDP Application Sockets (Gate to network) TCP: –Establish connection –Maintain connection during the communication.
Elementary TCP Sockets
Socket Programming. Introduction Sockets are a protocol independent method of creating a connection between processes. Sockets can be either – Connection.
CS345 Operating Systems Φροντιστήριο Άσκησης 2. Inter-process communication Exchange data among processes Methods –Signal –Pipe –Sockets.
9/12/2015B.R1 Socket Abstraction and Interprocess Communication B.Ramamurthy CSE421.
Remote Shell CS230 Project #4 Assigned : Due date :
TELE 402 Lecture 10: Unix domain … 1 Overview Last Lecture –Daemon processes and advanced I/O functions This Lecture –Unix domain protocols and non-blocking.
Chapter 14 Unix domain protocol. contents Introduction unix domain socket address structure socketpair socket function unix domain stream client-server.
Networking Tutorial Special Interest Group for Software Engineering Luke Rajlich.
CS 158A1 1.4 Implementing Network Software Phenomenal success of the Internet: – Computer # connected doubled every year since 1981, now approaching 200.
Advanced Sockets API-II Vinayak Jagtap
Distributed Computing A Programmer’s Perspective.
TELE202 Lecture 15 Socket programming 1 Lecturer Dr Z. Huang Overview ¥Last Lecture »TCP/UDP (2) »Source: chapter 17 ¥This Lecture »Socket programming.
Introduction to Socket
CSE/EE 461 Getting Started with Networking. 2 Basic Concepts A PROCESS is an executing program somewhere. –Eg, “./a.out” A MESSAGE contains information.
Consider Letting inetd Launch Your Application. inetd daemon  Problems starting with /etc/rc(without inet daemon)  All the servers contains nearly identical.
Socket Programming Introduction. Socket Definition A network socket is one endpoint in a two-way communication flow between two programs running over.
Client/Server Socket Programming Project
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.
Introduction to Sockets
S OCKET P ROGRAMMING IN C Professor: Dr. Shu-Ching Chen TA: Hsin-Yu Ha.
CSCI 330 UNIX and Network Programming Unit XIV: User Datagram Protocol.
回到第一頁 Client/sever model n Client asks (request) – server provides (response) n Typically: single server - multiple clients n The server does not need.
1 Spring Semester 2008, Dept. of Computer Science, Technion Internet Networking recitation #7 Socket Programming.
Advanced UNIX programming Fall 2002 Instructor: Ashok Srinivasan Lecture 28 Acknowledgements: The syllabus and power point presentations are modified versions.
Socket programming in C. Socket programming with TCP Client must contact server server process must first be running server must have created socket (door)
Lecture 3 TCP and UDP Sockets CPE 401 / 601 Computer Network Systems slides are modified from Dave Hollinger.
Socket Programming in C CS587x Lecture 3 Department of Computer Science Iowa State University.
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.
1 Socket Interface. 2 Basic Sockets API Review Socket Library TCPUDP IP EthernetPPP ARP DHCP, Mail, WWW, TELNET, FTP... Network cardCom Layer 4 / Transport.
Socket Abstraction and Interprocess Communication
UDP Socket Programming
Sockets and Beginning Network Programming
Socket Programming in C
Interprocess Communication
Interacting With Protocol Software
UNIX Domain sockets The Linux Programming Interface (ch 57)
Socket Abstraction and Interprocess Communication
Advanced Network Programming spring 2007
Socket Abstraction and Interprocess Communication
Socket Abstraction and Inter-process Communication
Socket Abstraction and Interprocess Communication
Interprocess Communication
Socket Abstraction and Interprocess Communication
Socket Abstraction and Interprocess Communication
Socket Abstraction and Interprocess Communication
Socket Abstraction and Inter-process Communication
Sockets Programming Socket to me!.
Socket Abstraction and Inter-process Communication
Sockets Programming Socket to me!.
Sockets.
Today’s topic: Basic TCP API
Presentation transcript:

1 Unix Domain Protocols when client and server are on the same host Unix domain socket address structure Socket functions Stream client-server Datagram client-server Passing descriptors Receiving sender credentials

2 Unix Domain Socket Address Structure #include struct sockaddr_un { uint8_t sun_len; sa_family_t sun_family; /* AF_LOCAL */; char sun_path[104]; /* null-terminated pathname */ };

3 Socket Functions #include int socketpair (int family; int type, int protocol, int sockfd[2]); returns: nonzero if OK, -1 on error creates two sockets that are connected together family: AF_LOCAL, protocol: 0, type: SOCK_STREAM or SOCK_DGRAM All socket functions for TCP and UDP sockets can be used, but several restrictions apply.

4 Passing Descriptors between Related/Unrelated Processes Create a Unix domain socket, either stream or datagram One process opens a descriptor The sending process builds a msghdr structure containing the descriptor to be passed, calls sendmsg The receiving process calls recvmsg

5 Receiving Sender Credentials through a Unix domain socket Include Struct fcred{ uid_t fc_ruid; /* real user ID */ gid_t fc_rgid; /* real group ID */ char fc_login[MAXLOGNAME]; /* setlogin() name */ uid_t fc_uid; /* effective user ID */ fc_ngroups; /* number of group */ gid_t fc_groups[NGROUPS]; /* supplementary group IDs */ }; #define fc_gid fc_groups[0] /* effective group ID */