网络编程1

来源:互联网 发布:java if else语句举例 编辑:程序博客网 时间:2024/05/17 20:35
计算机网络
     通过网络连接介质,讲多台计算机和设备连接在一起,组成的计算机系统

 如何通讯
     网络通讯协议
          网络设备通讯的规则

移动互联网应用基本架构

服务器
     1.web服务器
     2.数据库服务器

开启php  cd /etc/apache2/
          sudo vi httpd.conf 
把包含php字样的..前面的#去掉

然后重新打开apache
sudo apachectl start 

---------------------------------------------

同步

 url=[NSStringstringWithFormat:@"http://10.2.145.162/denglu.php?name=%@&pass=%@",text_name.text,text_pass.text ];

    url_u=[NSURLURLWithString:url];

    //请求对象

    request=[NSURLRequestrequestWithURL:url_u];

   NSError *error;

    NSData *data= [NSURLConnectionsendSynchronousRequest:requestreturningResponse:nilerror:&error];//接收返回的数据,然后判断



-----------

异步

遵守

<NSURLConnectionDelegate,NSURLConnectionDataDelegate>两个协议

//实现下列方法.

- (void)connectionDidFinishLoading:(NSURLConnection *)connection ;//处理接受完成的数据

- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data;//接受数据




原创粉丝点击