csci5211-socket

csci5211-socket - CSci5211: Socket API 1 I ntroduction to...

Info iconThis preview shows pages 1–9. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: CSci5211: Socket API 1 I ntroduction to Socket Programming Socket Programming Overview Part I : BSD Unix C Socket Programming API Handle asynchronous input output from multiple socket descriptors Creating concurrent server Part I I : Java Socket Programming Java thread for concurrent server Additional Readings on BSD Socket on class website; Online Project I Description CSci5211: Socket API 2 Refreshing Host (NI C card) identified by unique I P address Network application/ process identified by port number Network connection identified by a 5-tuple ( src ip, src port, dst ip, dst port, protocol ) Two kinds of I nternet transport services provided to applications Connection-oriented TCP Connectionless UDP CSci5211: Socket API 3 Socket Programming API API : Application Programming I nterface Socket analogous to door sending process shoves message out door sending process assumes transport infrastructure on other side of door which brings message to socket at receiving process host-local, application created/ owned, OS-controlled connection between sockets set-up/ managed by OS process TCP with buffers, variables socket host or server process TCP with buffers, variables socket host or server Internet controlled by OS controlled by app developer CSci5211: Socket API 4 What API s Needed? How to create socket (door) How to establish connection Client connects to a server Server accepts client req. How to send/ recv data How to identify socket Bind to local address/ port How to close socket (door) How to create socket How to send/ recv data How to identify socket How to close socket Connection-Oriented TCP Connectionless UDP CSci5211: Socket API 5 Socket: Conceptual View socket() CSci5211: Socket API 6 What We Will Learn Next Part I The hard way: but youll have a far better understanding how things work! First: BSD Unix C Socket Programming API Socket operations: system calls into OS Second: Writing server and client in C to handle asynchronous input output from multiple socket descriptors and concurrent server Part I I The easier way: as Java cover some nuts & bolts under the hood Third: Java Socket Programming Forth: Java Thread for concurrent server CSci5211: Socket API 7 BSD Unix C Socket Programming API (Window has slightly different API ) Note: If you only know Java, and dont want to learn about C socket programming, you can skip this part, and go directly to Slide 58 CSci5211: Socket API 8 Creating a Socket Format: int socket(family, type, protocol); domain, service and protocol parameters: family: PF_I NET/ AF_I NET, PF_UNI X/ AF_UNI X service: SOCK_DGRAM: datagram service (i.e., UDP) SOCK_STREAM: byte stream service (i.e.,TCP) protocol: usually 0 for default type return a socket descriptor, like a file descriptor in Unix #include <sys/types.h> #include <sys/socket.h> if (sd = socket(AF_INET, SOCK_STREAM, 0) <0 ){ perror (socket); /* socket creation error */ } CSci5211:...
View Full Document

This note was uploaded on 10/09/2009 for the course CSCI 5211 taught by Professor Staff during the Fall '08 term at Minnesota.

Page1 / 74

csci5211-socket - CSci5211: Socket API 1 I ntroduction to...

This preview shows document pages 1 - 9. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online