/* fpont 1/00 */
/* pont.net */
/* tcpServer.c */
#include
#include
#include
#include
#include
#include
#include
#define SUCCESS 0
#define ERROR 1
#define END_LINE 0x0
#define SERVER_PORT 1500
#define MAX_MSG 100
/* function readline */
int read_line();
int string_length(char string[]) {
int i;
i = 0;
while (string[i] != '\0') i++;
return i;
}
void string_concat(char st1[], char st2[], char result[]) {
int i, j;
i = 0;
while ( (result[i] = st1[i]) != '\0' ) i++;
j = i;
while ( (result[i] = st2[i - j]) != '\0' ) i++;
}
void substring(char string[], int start, int length, char result[]) {
int i;
if ( string_length(string) %s\n",st1);
substring(buf , 1 , 20, st2);
printf(">%s\n",st2);
st1_i = atoi(st1);
if ( st1_i == 1 ) {
string_concat("fglrun /u/siltron/aim/4gi41/pda_aimt370S ", st2, cmd);
printf("1>>%s\n",cmd);
}
if ( st1_i == 2 ) {
string_concat("fglrun /u/siltron/aim/4gi41/pda_aimt306Y ", st2, cmd);
printf("2>>%s\n",cmd);
}
if ( st1_i == 3 ) {
string_concat("fglrun /u/siltron/aim/4gi41/pda_aimt306S ", st2, cmd);
printf("3>>%s\n",cmd);
}
if ( st1_i == 4 ) {
string_concat("fglrun /u/siltron/aim/4gi41/pda_aimt309S ", st2, cmd);
printf("4>>%s\n",cmd);
}
if ( st1_i == 5 ) {
string_concat("fglrun /u/siltron/aim/4gi41/pda_aimt324S ", st2, cmd);
printf("5>>%s\n",cmd);
}
if ( st1_i == 6 ) {
string_concat("fglrun /u/siltron/apm/4gi41/pda_apmt722Y ", st2, cmd);
printf("6>>%s\n",cmd);
}
system(cmd);
send(clientfd, buffer, sizeof(buffer), 0);
/* close(client) */
close(clientfd);
}
/* close(server) , but never get here because of the loop */
close(sockfd);
return 0;
}
要編釋這個程式,使用指令: gcc sample-server.c -o sample-server
要執行程式可以使用指令: ./sample-server
http://www.linuxhall.org/modules.php?name=News&file=article&sid=79
- Dec 25 Tue 2007 15:46
可透過Socket執行Informix 4GL程式(Server端)
全站熱搜
留言列表
禁止留言