基于嵌入式linux的网络聊天室的实现,有详细的软件设计文档,用户手册,及源码
代码片段和文件信息
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 364032 2008-09-09 21:04 embedded linux chat room网络聊天系统用户手册.doc
文件 668672 2007-02-09 14:16 embedded linux chat room网络聊天系统详细设计文档.doc
文件 11528 2007-02-12 15:01 embedded linux chat room聊天室参考设计.txt
文件 39595 2007-02-09 14:48 embedded linux chat room聊天室项目程序clientclient
文件 9295 2007-02-09 12:48 embedded linux chat room聊天室项目程序clientclient.c
文件 665 2007-02-08 14:14 embedded linux chat room聊天室项目程序clientclient.h
文件 280 2007-02-08 14:10 embedded linux chat room聊天室项目程序clientclient.h~
文件 2944 2007-02-09 09:15 embedded linux chat room聊天室项目程序clientclient_help.c
文件 3208 2007-02-09 14:17 embedded linux chat room聊天室项目程序clientclient_online_list.c
文件 407 2007-02-08 14:24 embedded linux chat room聊天室项目程序clientclient_online_list.h
文件 4612 2007-02-09 14:48 embedded linux chat room聊天室项目程序clientdivide_screen.c
文件 4507 2007-02-07 21:05 embedded linux chat room聊天室项目程序clientdivide_screen.c~
文件 108 2007-02-06 18:23 embedded linux chat room聊天室项目程序clientgui.h
文件 235 2007-02-09 09:15 embedded linux chat room聊天室项目程序clientmakefile
文件 1034 2007-02-08 21:58 embedded linux chat room聊天室项目程序clientmsg_list.c
文件 270 2007-02-08 21:56 embedded linux chat room聊天室项目程序clientmsg_list.h
文件 336 2007-02-09 10:36 embedded linux chat room聊天室项目程序clientsec_group.h
文件 900 2007-02-09 16:04 embedded linux chat room聊天室项目程序clientuser_talk_record
文件 512 2007-02-08 21:18 embedded linux chat room聊天室项目程序clientwrite_record.c
文件 109 2007-02-08 21:51 embedded linux chat room聊天室项目程序clientwrite_record.h
文件 39667 2007-02-09 11:32 embedded linux chat room聊天室项目程序client1.4
文件 76635 2007-02-09 10:19 embedded linux chat room聊天室项目程序document eam2.tar.gz
文件 70043 2007-02-09 10:47 embedded linux chat room聊天室项目程序document eam2c.tar.gz
文件 363008 2008-07-14 20:24 embedded linux chat room聊天室项目程序document网络聊天系统用户手册.doc
文件 668672 2007-02-09 14:16 embedded linux chat room聊天室项目程序document网络聊天系统详细设计文档.doc
文件 50 2007-02-09 11:29 embedded linux chat room聊天室项目程序
ame.txt
文件 221 2007-02-09 09:44 embedded linux chat room聊天室项目程序servermakefile
文件 219 2007-02-09 15:56 embedded linux chat room聊天室项目程序server
ame.txt
文件 4169 2007-02-09 16:19 embedded linux chat room聊天室项目程序serveronline_struct.c
文件 460 2007-02-09 09:44 embedded linux chat room聊天室项目程序serveronline_struct.h
............此处省略25个文件信息
/* client.c
*
* data:07-02-07
*
* version:1.3
* */
#include“sec_group.h“
#include“client.h“
#include“client_online_list.h“
#include “gui.h“
#include “msg_list.h“
#include “write_record.h“
#define port 8001
char TOWHO[20];
void thread(int sock_fd);
void record_select(void);
/*------------------------------------*/
void first_print_select(int fd);
void client_load_deal(int sock_fd);
void client_reg_deal(int sock_fd);
void client_command_to(char * bufchar * name);
void client_command_quit(int fd);
void use_command_to_deal(char *buf);
/*-----------------------------------------*/
/* the first *//* 1^*/
/* include two function to make a link */
int main(int argc char *argv[])
{
int wild_sock_fd;
client_help(argcargv);
memset(TOWHO020);
wild_sock_fd = create_connect_server();
deal_connect(wild_sock_fd);
return 0;
}
/*-----------------------------------------*/
/* the two *//* 2^*/
/* create the connet it didn‘t have another function*/
int create_connect_server(void)
{
struct sockaddr_in pin;
int sock_fd;
int n;
bzero(&pin sizeof(pin));
pin.sin_family = AF_INET;
inet_pton(AF_INET IP &pin.sin_addr);
pin.sin_port = htons(port);
sock_fd = socket(AF_INET SOCK_STREAM 0);
if(sock_fd == -1)
{
perror(“call to socket“);
exit(1);
}
n = connect(sock_fd (void *)&pin sizeof(pin));
if(n == -1)
{
perror(“call to connect“);
exit(1);
}
return sock_fd;
}
void *thr_gui(void *arg)
{
gui_main();
}
/* you see the first from the client */
void first_print_select(int fd)
{
int ch;
int client_select_flag = 0;
do
{
printf(“
please input ‘r‘ to register and input ‘l‘ to load
“);
ch = getchar();
while((getchar()) != ‘
‘);
if(ch == ‘r‘)
{
client_reg_deal(fd);
client_select_flag = 1;
}
else if(ch == ‘l‘)
{
client_load_deal(fd);
client_select_flag = 1;
}
}while(client_select_flag != 1);
}
/* create a pthread to deal the chat */
void deal_connect(int sock_fd)
{
int id;
int n;
pthread_t tid;
char buf[MAXLINE];
first_print_select(sock_fd);
if( 0 != pthread_create(&tid NULL thr_gui NULL) )
{
printf(“can not create gui!
“);
exit(1);
}
usleep(200);
pthread_create((void *)&idNULL(void *)thread(void *)sock_fd);
while(1)
{
read_from_client(buf);
client_information_judge_deal(bufsock_fd);
write_to_server(bufsock_fd);
memset(buf0MAXLINE);
}
n = close(sock_fd);
if(n == -1)
{
perror(“call to close“);
exit(1);
}
exit(0);
}
/*----------------------------------------------*/
/* the third *//*3^*/
/* the pthread function circle to read and the write to client */
void thread(int sock_fd)
{
int n;
char *buf = (char *)malloc(MAXLINE);
while(1)
{
memset(buf0MAXLINE);
n = read_from_server(sock_fdbuf);
if( n == -1)
{
perror(“call to read“);
exit(1);
}
if((buf[0] == ‘9‘ && buf[1] == ‘9‘) || (buf[0]== ‘8‘ && buf[1] == ‘8‘))
{
plist new;
new =(plist) malloc (sizeof(str
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 364032 2008-09-09 21:04 em
文件 668672 2007-02-09 14:16 em
文件 11528 2007-02-12 15:01 em
文件 39595 2007-02-09 14:48 em
文件 9295 2007-02-09 12:48 em
文件 665 2007-02-08 14:14 em
文件 280 2007-02-08 14:10 em
文件 2944 2007-02-09 09:15 em
文件 3208 2007-02-09 14:17 em
文件 407 2007-02-08 14:24 em
文件 4612 2007-02-09 14:48 em
文件 4507 2007-02-07 21:05 em
文件 108 2007-02-06 18:23 em
文件 235 2007-02-09 09:15 em
文件 1034 2007-02-08 21:58 em
文件 270 2007-02-08 21:56 em
文件 336 2007-02-09 10:36 em
文件 900 2007-02-09 16:04 em
文件 512 2007-02-08 21:18 em
文件 109 2007-02-08 21:51 em
文件 39667 2007-02-09 11:32 em
文件 76635 2007-02-09 10:19 em
文件 70043 2007-02-09 10:47 em
文件 363008 2008-07-14 20:24 em
文件 668672 2007-02-09 14:16 em
文件 50 2007-02-09 11:29 em
ame.txt
文件 221 2007-02-09 09:44 em
文件 219 2007-02-09 15:56 em
ame.txt
文件 4169 2007-02-09 16:19 em
文件 460 2007-02-09 09:44 em
............此处省略25个文件信息
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件举报,一经查实,本站将立刻删除。
评论列表(条)