Your SlideShare is downloading. ×
  • Like
Networking chapter III
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Now you can save presentations on your phone or tablet

Available for both IPhone and Android

Text the download link to your phone

Standard text messaging rates apply

Networking chapter III

  • 381 views
Published

Networking chapter - III is about doing network programming using sockets.

Networking chapter - III is about doing network programming using sockets.

Published in Technology , Education
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to like this
No Downloads

Views

Total Views
381
On SlideShare
0
From Embeds
0
Number of Embeds
0

Actions

Shares
Downloads
8
Comments
1
Likes
0

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. Compiled by: Jayakumar Balasubramanian Web: http://www.jwritings.com Email: [email_address]
  • 2. Introduction
    • Introduction to sockets
    • The “Endian” concept
    • Trivial functions
    • Socket APIs
    • Client server programming using sockets
  • 3. Introduction
  • 4. The “Endian” concept
  • 5. Big-Endian
  • 6. Little-Endian
  • 7. Bit order transformation
  • 8. Trivial functions
  • 9. How does one talk to TCP/IP ?
  • 10. Addressing in IP and TCP
  • 11. Socket address
  • 12. Socket APIs
  • 13. API : Socket ()
    • Use to create a socket.
    • fd = socket (family, type, protocol)
    • Family : AF_INET, AF_UNIX, AF_NS
    • Type : SOCK_STREAM, SOCK_DGRAM
    • Protocol : Protocol for a given socket
  • 14. API: bind() [The anchor]
  • 15. API: bind()
    • Attach a transport address to a socket.
    • status = bind (fd, addressp, addrlen);
    • fd : Socket descriptor
    • addressp : Pointer to address structure
    • addrlen : Size of address structure
  • 16. API: connect()
  • 17. API : connect()
    • The connect function is used by a TCP client to
    • establish a connection with a TCP server
    • int fd, status, addrlen;
    • struct sockaddr *addressp;
    • status = connect (fd, addresssp, addrlen);
  • 18. API: listen()
  • 19. API: listen()
    • listen()
    • Prepares a socket to accept connections
    • Must be used only on the server side of the application before any connection request is accepted.
    • int fd, qlen, status;
    • status = listen (fd, qlen);
    • fd : Socket descriptor
    • qlen : Length of the queue
  • 20. API : accept()
  • 21. API : accept()
    • Used in the server side of the connection to accept incoming new connections
    • When requests arrives it creates new socket, accepts the connection on the new socket
    • int newfd, addrlen;
    • struct sockaddr * addressp;
    • newfd = accept (fd, addressp, & addrlen);
  • 22. Connection establishment
  • 23. API : send()
    • Sends data over a communication channel
    • Can be used in server and client side
    • int fd, len, flags;
    • char *buff;
    • sent = send (fd, buff, len, flags);
    • sent can be <= len
  • 24. API : recv()
    • R eceives data over a communication channel
    • Can be used in server and client side
    • int fd, len, flags, received;
    • char *buff;
    • received = recv (fd, buff, len, flags);
  • 25. API: close()
    • Close terminates both directions of data transfer, reading and writing.
    • close( sockfd)
  • 26. Web : http://www.jwritings.com Email: [email_address]