设为首页 加入收藏

TOP

Unix-domain-socket详解UDP(二)
2014-11-24 01:09:18 来源: 作者: 【 】 浏览:13
Tags:Unix-domain-socket 详解 UDP
ss_udp));
server_address_udp.sun_family = AF_UNIX;
strcpy(server_address_udp.sun_path, SOCK_UNIX_VIDEO_STREAM_FILE_SEVER);


joseph_ipnc_s_socket.joseph_ipnc_s_socket_fd_udp = 0;
joseph_ipnc_s_socket.joseph_ipnc_s_socket_fd_udp = client_sockfd;


printf("%s %d The udp mode send to jss succeed ,joseph_ipnc_s_socket_fd_udp is %d !\n",__FUNCTION__,__LINE__,joseph_ipnc_s_socket.joseph_ipnc_s_socket_fd_udp);


#endif
return 0;
}



void net_send_stream_first(void *video_buf,int video_length)
{
int s_length;


#if 0
if(video_length <= 8) return;
#else
if(video_length <= 4) return;
#endif



if(joseph_ipnc_s_socket.joseph_ipnc_s_scoket_sta == 1)
{


#if 1
char buf_time[128] = {0};
memset(buf_time,0,128);
get_current_time(buf_time);

printf("%s %d %s send begin time is : \n",__FUNCTION__,__LINE__,buf_time);

printf("%s %d The num is %d ,The buf size is %d !\n",__FUNCTION__,__LINE__,joseph_ipnc_param.joseph_ipnc_network_attr.joseh_send_to_jss_frame_num,video_length);

printf("%s %d joseph_ipnc_s_socket.joseph_ipnc_s_socket_fd_udp is %d \n",__FUNCTION__,__LINE__,joseph_ipnc_s_socket.joseph_ipnc_s_socket_fd_udp);

#endif


#if 0

s_length = send(joseph_ipnc_s_socket.joseph_ipnc_s_scoket_fd, video_buf, video_length, 0);
#else
/*
int sendto ( socket s , const void * msg, int len, unsigned int flags, const struct sockaddr * to , int tolen ) ;
sendto(sockfd, buffer, len, 0, (struct addr*)&addr, addr_len); ±
*/


s_length = sendto(joseph_ipnc_s_socket.joseph_ipnc_s_socket_fd_udp, video_buf, video_length, 0,(struct sockaddr*)&server_address_udp,SUN_LEN(&server_address_udp));


#endif


if(s_length <= 0)
{
printf("%s %d The send is err, The length is %d !!! \n",__FUNCTION__,__LINE__,s_length);
close(joseph_ipnc_s_socket.joseph_ipnc_s_scoket_fd);
//close(joseph_ipnc_s_socket.joseph_ipnc_s_socket_fd_udp);
joseph_net_lock();
joseph_ipnc_s_socket.joseph_ipnc_s_scoket_sta = -2;
joseph_net_unlock();
//exit(-2);


}
else
{
//printf("%s %d net_send_stream_first succeed \n",__FUNCTION__,__LINE__);
//do nothing
}


#if 0
memset(buf_time,0,128);
get_current_time(buf_time);

printf("%s %d %s send end time is : \n",__FUNCTION__,__LINE__,buf_time);

#endif


}
else
{


// do nothing


}



}


首页 上一页 1 2 下一页 尾页 2/2/2
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇嵌入式 Linux C如何打印64bit的lo.. 下一篇嵌入式 hi3518c本地udp套接示例以..

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: