12 Star 20 Fork 8

cM / rtp2jpeg

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
sock.c 1.19 KB
一键复制 编辑 原始数据 按行查看 历史
/*************************************************************************
> File Name: sock.c
> Author:
> Mail:
> Created Time: 2015年01月26日 星期一 09时13分46秒
************************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <pthread.h>
#include <errno.h>
#include <malloc.h>
#include <sys/types.h>
#include <time.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <signal.h>
#include <unistd.h>
#include "sock.h"
struct server *server;
void init_sock(int argc,char **argv)
{
struct sockaddr_in remote;
int len = sizeof(remote);
server = (struct server*)malloc(sizeof(struct server));
server->client.port = atoi(argv[2]);
server->client.addr = strdup(argv[1]);
remote.sin_family = AF_INET;
remote.sin_port = htons(atoi(argv[2]));
remote.sin_addr.s_addr=inet_addr(argv[1]);
server->sockfd = socket(AF_INET,SOCK_DGRAM,0);
connect(server->sockfd,(const struct sockaddr*)&remote,len);
}
void send_sock(unsigned char *sendbuf,int len)
{
int ret=0;
ret=send(server->sockfd,sendbuf,len,0);
if(ret < 0){
printf("send error\n");
exit(1);
}
}
C
1
https://gitee.com/OpenWrt-X/rtp2jpeg.git
git@gitee.com:OpenWrt-X/rtp2jpeg.git
OpenWrt-X
rtp2jpeg
rtp2jpeg
master

搜索帮助

53164aa7 5694891 3bd8fe86 5694891