Community: Wiki

你在这里: You Are Here: Olet tässä: Vous êtes ici: Sie befinden sich hier: Tu sei qui: 現在のページ: Você está aqui: Вы здесь: Usted está aquí:
This page was last modified 13:27, 17 June 2008.

Open C Sockets: shutdown method

From Forum Nokia Wiki


The shutdown method shuts down part of a full-duplex connection.

int shutdown (int sockfd, int how);

The shutdown system call causes all or part of a full-duplex connection on the socket associated with the file descriptor sockfd to be shutdown. The how argument specifies the type of shutdown. Possible values are:

  • SHUT_RD -- further receives will be disallowed.
  • SHUT_WR -- further sends will be disallowed.
  • SHUT_RDWR-- further sends and receives will be disallowed.

Following is the usage of shutdown function in Open C socket interface:

#include <sys/socket.h>
#include <netinet/in.h>
#include <unistd.h>
TInt shutdown_example()
{
   int sock_fd;
   sockaddr_in addr,ss;
   unsigned int len;   
   
   sock_fd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
       
   addr.sin_family = AF_INET;
   addr.sin_addr.s_addr = htonl(INADDR_ANY);
   addr.sin_port = htons(5000);
   bind(sock_fd,(sockaddr*)&addr,sizeof(addr));
   shutdown(sock_fd, SHUT_RD)
   close(sock_fd);
}


Wiki Links

Open C Sockets Overview

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditFurlTechnocratiMagnoliaTwitter  Share this page Share this page Invite a friend Invite a friend
E-mail Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us Regional websites: Chinese Japanese © 2008 Nokia 
RDF Facets: qfnZtypeQUqfnTypeZCommunityContentQ qfnZtypeQUqfnTypeZWebpageQ qfnZtypeQUqfnTypeZWikiContentQ qmarsZlanguageQUxhttpE3aE2fE2fswE2enokiaE2ecomE2flanguageE2d1E2fenX