没有合适的资源?快使用搜索试试~ 我知道了~
语音通信原理
4星 · 超过85%的资源 需积分: 50 13 下载量 154 浏览量
2012-10-30
12:57:28
上传
评论 1
收藏 7KB TXT 举报
温馨提示
试读
8页
语音通信,IOS,客户端,webservice
资源推荐
资源详情
资源评论
客户端代码是这样的。。。
#import "ViewController.h"
@implementation ViewController
-(void)aaa:(UIButton *)btn
{
NSString *method=[NSString stringWithFormat:@"login"];
NSString *username=[NSString stringWithFormat:@"123"];
NSString *password=[NSString stringWithFormat:@"123"];
NSString *urlString= [NSString stringWithFormat:@"http://192.168.1.107:8080/ipTest/test.do?%@%@&%@%@&%@%@",@"method=",method,@"username=",username,@"password=",password];
ASIFormDataRequest *requestForm = [[ASIFormDataRequest alloc] initWithURL:[NSURL URLWithString:urlString]];
//设置需要POST的数据,这里提交两个数据,A=a&B=b
//[requestForm setPostValue:@"a" forKey:@"A"];
//[requestForm setPostValue:@"b" forKey:@"B"];
[requestForm startSynchronous];
//输入返回的信息
NSLog(@"response\n%@",[requestForm responseString]);
[requestForm release];
}
- (void)viewDidLoad
{
[super viewDidLoad];
button1=[[UIButton alloc]initWithFrame:CGRectMake(200, 200, 50, 50)];
button1.backgroundColor=[UIColor redColor];
[self.view addSubview:button1];
#import "ViewController.h"
@implementation ViewController
-(void)aaa:(UIButton *)btn
{
NSString *method=[NSString stringWithFormat:@"login"];
NSString *username=[NSString stringWithFormat:@"123"];
NSString *password=[NSString stringWithFormat:@"123"];
NSString *urlString= [NSString stringWithFormat:@"http://192.168.1.107:8080/ipTest/test.do?%@%@&%@%@&%@%@",@"method=",method,@"username=",username,@"password=",password];
ASIFormDataRequest *requestForm = [[ASIFormDataRequest alloc] initWithURL:[NSURL URLWithString:urlString]];
//设置需要POST的数据,这里提交两个数据,A=a&B=b
//[requestForm setPostValue:@"a" forKey:@"A"];
//[requestForm setPostValue:@"b" forKey:@"B"];
[requestForm startSynchronous];
//输入返回的信息
NSLog(@"response\n%@",[requestForm responseString]);
[requestForm release];
}
- (void)viewDidLoad
{
[super viewDidLoad];
button1=[[UIButton alloc]initWithFrame:CGRectMake(200, 200, 50, 50)];
button1.backgroundColor=[UIColor redColor];
[self.view addSubview:button1];
[button1 addTarget:self action:@selector(aaa:) forControlEvents:UIControlEventTouchUpInside];
// Do any additional setup after loading the view, typically from a nib.
}
- (void)viewDidUnload
{
[super viewDidUnload];
// Release any retained subviews of the main view.
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
}
@end
客户端想要访问服务器 必须加上服务器的ip 服务端我是这样实现的。。。
服务器是用java开发的
public void doLogin(HttpServletRequest request,HttpServletResponse response) throws IOException{
String username=request.getParameter("username");
String password=request.getParameter("password");
String getStr=request.getParameter("A");
System.out.println("用户名:"+username+ "密码:"+password);
getAddr(request);
PrintWriter out=response.getWriter();
String msg=null;
if(username!=null&&username.equals("123")&&password!=null &&password.equals("123")&& getStr!=null&&getStr.equals("a")){
msg="登陆成功";
// Do any additional setup after loading the view, typically from a nib.
}
- (void)viewDidUnload
{
[super viewDidUnload];
// Release any retained subviews of the main view.
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
}
@end
客户端想要访问服务器 必须加上服务器的ip 服务端我是这样实现的。。。
服务器是用java开发的
public void doLogin(HttpServletRequest request,HttpServletResponse response) throws IOException{
String username=request.getParameter("username");
String password=request.getParameter("password");
String getStr=request.getParameter("A");
System.out.println("用户名:"+username+ "密码:"+password);
getAddr(request);
PrintWriter out=response.getWriter();
String msg=null;
if(username!=null&&username.equals("123")&&password!=null &&password.equals("123")&& getStr!=null&&getStr.equals("a")){
msg="登陆成功";
剩余7页未读,继续阅读
资源评论
- ascii_he2013-01-24这个就是一点代码
- langmanxch2012-11-23主要是代码,客户端较少
- gaoyp2012-11-10重点是服务端。客户端说的少。
阿贝是宝贝的贝
- 粉丝: 2
- 资源: 9
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功