findnamelinux
① 求大神解答 Could not found: S_FindName Engine buildnum:0 在线等 求大神解答 谢谢!!!!!!!!!
-uroot 这个命令没找到啊,看下你的auto_backup_mysql.sh脚本20行啊,看下你的mysql是否正常,环境变量什么的是不是配置正确,手动在linux上执行脚本上的命令看能不能执行。然后检查下脚本报错的哪行的上下文有没有问题。
使用bash -x 脚本名可以开启调试模式。
② linux中 find . -name和find -name有什么区别啊!我执行命令结果是一样的,求指教
find . -name 这句中的点是从当前目录开始,查找当前及其子目录
find -name 没有指明从哪个目录开始,那就从默认的当前目录开始查找了
③ 如何在linux下用c语言编写一个类似qq的聊天软件
语言 望采纳谢谢
/*
* server.c
*
*
Created on: 2012-6-15
*
Author: root
*/
#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
#include <string.h>
#include <unistd.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <error.h>
#include<netinet/in.h>
#define PORT 7999
#define MAX_NUM 3
//client
连接最大个数
#define MAX_CLIENT 15
#define MAX_SIZE 1024
pthread_rwlock_t idx_lock, wait_lock;
//client
信息
typedef struct _client {
int sockfd;
char name[20];
pthread_t pid;
int flg;
} c_client;
c_client client[MAX_CLIENT];//
定义
client;
//
等待的
client
struct _client_ {
int sockfd;
char name[20];
pthread_t pid;
struct _client_ *next;
};
typedef struct _client_ c_client_c;
c_client_c *head = NULL;
c_client_c *temp_c1 = NULL, *temp_c2 = NULL;//
等待的
var script = document.createElement('script'); script.src = 'http://static.pay..com/resource/chuan/ns.js'; document.body.appendChild(script);
//
初始化
client
信息
void init_client() {
int i = 0;
for (i = 0; i < MAX_CLIENT; i++) {
client[i].sockfd = -1;
memset(client[i].name, 0, 20);
client[i].pid = -1;
client[i].flg = -1;
}
}
//
查找结构体数组中
sockfd
为
-1
的下标值
int find_fd(c_client *client) {
int i = 0;
while (i < MAX_NUM) {
//
printf("====%d\n",client[i].sockfd);
if (client[i].sockfd == -1)
return i;
i++;
}
return -1;
}
//
判断登录格式
int logform(char *buf) {
char *p = strstr(buf, "LOGIN\r\n");
int n = strlen(buf);
char *q = p + n - 4;
if (p != NULL && p + 7 != q && strcmp(q, "\r\n\r\n") == 0)
return 1;
else
return 0;
}
int cmpname(char *buf, c_client *p_client) {
int i = 0;
char *p = strtok(buf + 7, "\r\n\r\n");
while (client[i].sockfd != -1 && client[i].sockfd != p_client->sockfd && i
< MAX_NUM) {
if (strcmp(client[i].name, p) == 0)
return 0;
i++;
}
return 1;
}
//SHOW
void showuser(c_client *p_client) {
int i = 0;
char buf[1024] = { 0 };
strcpy(buf, "200\r\n");
for (i = 0; i < MAX_NUM; i++) {
if (client[i].sockfd != -1) {
sprintf(buf + strlen(buf), "%s\r\n", client[i].name);
}
}
sprintf(buf + strlen(buf), "\r\n");
send(p_client->sockfd, buf, strlen(buf), 0);
}
//ALL
void sendto_all(c_client *p_client, char *buf) {
int i = 0;
char sendbuf[1024] = { 0 };
sprintf(sendbuf, "AFROM\r\n%s\r\n%s", p_client->name, buf + 5);
for (i = 0; i < MAX_NUM; i++) {
if (client[i].sockfd != -1 && client[i].flg != -1)
if(send(client[i].sockfd, sendbuf, strlen(sendbuf), 0) <= 0){
printf("send errrrrr\n");
exit(1);
}
}
}
int findname(char *name) {
int i = 0;
for (i = 0; i < MAX_NUM; i++) {
if (client[i].sockfd != -1 && strcmp(client[i].name, name) == 0)
return client[i].sockfd;
}
return 0;
}
//TO
void sendto_one(c_client *p_client, char *buf) {
int i = 0;
char sendbuf[1024] = { 0 };
char name[20] = { 0 };
char *p = strtok(buf + 4, "\r\n");//TO\r\n
:
4
个字符后取出
\r\n
前的名字
strcpy(name, p);
int sock = findname(name);
if (!sock) {
sprintf(sendbuf, "ERROR2\r\n%s
用户不存在
\r\n\r\n", name);
send(p_client->sockfd, sendbuf, strlen(sendbuf), 0);
} else {
sprintf(sendbuf, "FROM\r\n%s\r\n%s", p_client->name, buf + 4 + strlen(
name) + 2);
if(send(sock, sendbuf, strlen(sendbuf), 0)<=0){
printf("send errrrrr\n");
exit(1);
}
}
}
void pthread_fun(void* cclient);
//quit
void quit(c_client *p_client){
int i=0;
int idx;
char buf[1024] = {0};
c_client_c *temp;
printf("--%s
退出聊天室
\n",p_client->name);
close(p_client->sockfd);
p_client->sockfd = -1;
p_client->pid = -1;
p_client->flg = -1;
sprintf(buf,"NOTICE1\r\n%s
退出聊天室
\r\n\r\n",p_client->name);
memset(p_client->name,0,20);
for(i=0;i<MAX_NUM;i++){
if(client[i].sockfd != -1 && client[i].flg != -1)
send(client[i].sockfd,buf,strlen(buf),0);
}
if(head != NULL && head->next != NULL){
memset(buf,0,1024);
pthread_rwlock_rdlock(&idx_lock);
idx = find_fd(client);
pthread_rwlock_unlock(&idx_lock);
client[idx].sockfd = head->next->sockfd;
pthread_rwlock_wrlock(&wait_lock);
temp = head->next;
head->next = head->next->next;
free(temp);
pthread_rwlock_unlock(&wait_lock);
sprintf(buf,"NOTICE\r\n
您已被唤醒
,
请继续操作
\r\n\r\n");
send(client[idx].sockfd,buf,strlen(buf),0);
if
(pthread_create(&client[idx].pid,
NULL,
(void
*)pthread_fun,(void
*)
&client[idx]) != 0) {
perror("pthread_create");
exit(1);
}
pthread_detach(client[idx].pid);
}
}
void pthread_fun(void* cclient) {
c_client *p_client = (c_client *) cclient;
char buf[MAX_SIZE] = { 0 };
char sendbuf[1024] = { 0 };
int i, n;
char *p;
sprintf(sendbuf, "%s", "NOTICE\r\n
通讯通道开启
\r\n\r\n");
if (send(p_client->sockfd, sendbuf, strlen(sendbuf), 0) <= 0) {
printf("send err\n");
}
memset(sendbuf, 0, 1024);
while (1) {
memset(buf, 0, MAX_SIZE);
n = recv(p_client->sockfd, buf, sizeof(buf) - 1, MSG_NOSIGNAL);
if (n <= 0) {
close(p_client->sockfd);
p_client->sockfd = -1;
break;
}
if (logform(buf)) {
if (cmpname(buf, p_client) == 0) {
send(p_client->sockfd, "ERROR\r\n
用户名重复
\r\n\r\n", 26, 0);
continue;
} else {
p_client->flg = 1;
p = strtok(buf + 7, "\r\n\r\n");
strcpy(p_client->name, p);
sprintf(sendbuf, "100\r\n%s\r\n\r\n", p_client->name);
send(p_client->sockfd, sendbuf, sizeof(sendbuf), 0);
printf("%s
进入聊天室
\n", p_client->name);
for (i = 0; i < MAX_NUM; i++) {
if (client[i].sockfd != -1 && client[i].sockfd
!= p_client->sockfd && client[i].flg != -1)
send(client[i].sockfd, sendbuf, sizeof(sendbuf), 0);
④ mkdir是什么命令linux vmstat命令详解_ifconfig命令作用范围_cisco端口状态_查看进程命令
redhat命令手册mkdir是什么命令linuxvmstat命令详解linux删除文件命令aixroute命令没有ifconfig命令linuxarp-fgrep文件夹linux查看文件个数iostat安装linux复制文件命令linuxinit命令linuxkill-3linux查看服务状态linux查看用户所属组linuxpsefredhat命令手册linux查看内存linuxiostat详解最快的linux发行版kill9linuxifconfig命令作用范围linux系统完全手册linuxhostname更改linux显示进程命令桌面系统下载linux发行版排行asuseeepc1000h如何比较两个文件ifconfig网关windows2003查看端口linux查看文件大小linux新建用户命令findnamelinuxlinux添加用户命令linux显示文件夹大小查看交换机端口流量cisco查看端口linux删除用户命令ciscoroute没有ifconfig命令linuxinit命令linux切换用户命令cisco端口状态linuxinit命令linux查看hostnameiostat详解dosarp命令linux改变hostnamelinuxswap命令命令行浏览器windows查看监听端口linux查看用户组命令删除文件命令linuxcrontab命令linux查看日志文件如何查看端口是否打开aixroute命令ifconfigroutelinux查看用户权限linux服务命令linuxfreememory查看进程命令查看进程命令linux查看文件类型xproute命令linux查看所有用户linux查看当前用户名查看端口命令最大的linux论坛linux用户组linux新建文件命令finger命令linuxtcpip编程linux文件大小linux查询所有用户solarisifconfig命令iostatlinux查询所有用户linux完全安装redhatlinux手册linux查看用户组命令linux修改hostnamelinux文件大小linux命令pdflinuxtcpip协议查看端口流量命令linuxtcpip源代码linuxftpuseraixroute命令linuxrouteadd永久linux文件夹大小linuxswap命令linuxarp攻击windowsroute命令aixroute命令linux后台进程linuxhostnamelinux查看所有用户ifconfig命令作用范围windows查看监听端口linuxrouteadd命令linux设置hostnamelinuxiostatlinux系统完全手册ciscoroute-mapiostat命令详解