IOS network programming-socket programming in IOS

Source: Internet
Author: User

Use SOCKET for C/S structure programming and connection process

 

The server listens to a port for connection requests. ServerProgramThe client is in a blocked state and can only run down until it sends a connection request to the server. Once the connection is established, the input and output stream objects can be obtained through socket. You can use the input/output stream object to communicate with the client. Do not forget to close the socket and release some resources (including closing the input/output stream ).

The client process is to first specify the Server IP address and port to communicate with and the transmission protocol (TCP or UDP) used to send a connection request to the server. After the server responds to the request, a connection will be established. Then it is the same as the server.

In iOS, client socket programming can use three technologies:

1. Use nsstream. Objective-C language-oriented implementation of Apis provided by Apple's foundation framework;

2. Use cfstream. C language-oriented implementation, provided by the core foundation framework provided by Apple;

BSD socket. Berkeley socket is a widely used socket programming on UNIX platforms. It is implemented in C language and fully written in C, which is troublesome to use. It was developed by students at the University of California (Berkeley.

In iOS, server-side socket programming can use two technologies:

1. Use cfstream. C language-oriented implementation, provided by the core foundation framework provided by Apple;

2 BSD socket. Berkeley socket is a widely used socket programming on UNIX platforms. It is implemented in C language and fully written in C, which is troublesome to use. It was developed by students at the University of California (Berkeley.

IOS network programming and cloud application best practices http://www.iosbook3.com

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.