c编程 通讯协议http
问个比较弱的问题。
用c开发,服务器和客户端的程序,通讯协议用http。
不知道怎么入手了,是不是socket编程?还是应该看哪些方面的技术
有现成的http库 拿来用
自己写socket麻烦死了
网上找点代码! 自己写能烦死!
谢谢了
现在有哪些http库,比较常用的?
顶一下!
C/C++ code:
#include<iostream>
#include<map>
#include<stdlib.h>
#include<signal.h>
#include<errno.h>
#include<unistd.h>
#include<string.h>
#include<sys/resource.h>
#include<sys/stat.h>
#include<sys/types.h>
#include<fcntl.h>
#include<netinet/in.h>
#include<arpa/inet.h>
#include<sys/socket.h>
#define PORT 80
#define BUFSIZE 8196
#define LISTENQ 64 //
using namespace std;
struct client_t{
int fd;
int state;
unsigned int pois;
string ip;
string read_buf;
string write_buf;
//http request
string method_req;
string url;
string http_v;
string host;
client_t(){
fd=0;
state=0;//读写状态,0-读,1-写
pois=0;
ip.clear();
read_buf.reserve(BUFSIZE);
write_buf.reserve(BUFSIZE);
method_req.clear();
相关问答:
编译普通的c没问题啊,但编译javah生成的就报错:
gcc -O0 -g3 -Wall -c -fmessage-length=0 -oHelloWorld.o ..\HelloWorld.c
gcc -otest.exe HelloWorld.o
d:/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../. ......
编写程序detab, 将输入中的制表符替换成适当数目的空格,使空格充满到下一个制表符终止的地方。假设制表符终止位的位置是固定的,比如每隔n列就会出现一个制表符终止位。
------------------- ......
想知道每条指令或函数的系统消耗。比如系统执行int a=0;的开销是多少。有没有类似的文档之类的。不要和我说用什么clock()函数来测试。我想要相关总结好的文档
先反汇编,然后拿着cpu的指令手册查每条指令的时间周期 ......
问一下:
#include <stdio.h>
int main()
{
char x, y, z;
int i;
int a[16];
for(i=0; i<=16; i++)
{
a[i] = 0;
......