資源簡(jiǎn)介
C語(yǔ)言基于socket多人聊天(包含注冊(cè)登錄),有注冊(cè)和登錄模塊,驗(yàn)證通過(guò)才可以發(fā)信息。可實(shí)現(xiàn)多人同時(shí)在線發(fā)信息,或者一對(duì)一發(fā)信息
代碼片段和文件信息
/*
?*title:?client.c
?*start_time:?Mar.18?2011
?*end_time:??Apr.8?2011
?*/
#include?“i.h“
#define?START_PORT?8089
struct?sockaddr_in?my_addr;
int?my_id;
int?my_log();/*?declare?funtion*/
/*?*/
int?i_send_msg()
{
int?id;
struct?msg?the_msg;
char?end?=?‘@‘;
printf(“input?recver?id:“);
scanf(“%d“?&id);
getchar();
printf(“\ninput?content:“);
i_input(the_msg.content);
char?flag?=?‘y‘;
if?(1)
{
the_msg.flag?=?1;
the_msg.id_from?=?my_id;
the_msg.id_to?=?id;
i_sendto(sockfd?&the_msg?sizeof(struct?msg)?0
(struct?sockaddr*)&server?sizeof(struct?sockaddr));
i_saveto_chat(&the_msg);?/*?save?to?history?*/
printf(“send?to?id:%d?success.\n“?my_id);
return(0);
}
else
return(1);
return(0);
}
int?reply()
{
return(0);
}
int?send_file()
{
return(
?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
?????文件???????4768??2013-08-08?16:20??i.h
?????文件???????6083??2013-08-08?16:20??server.c
?????文件???????8113??2013-08-08?16:20??client.c
-----------?---------??----------?-----??----
????????????????18964????????????????????3
評(píng)論
共有 條評(píng)論