Tmax Programming Guide ( UCS ) Tmax 38 Tmax Programming Guide (UCS)

Size: px
Start display at page:

Download "Tmax Programming Guide ( UCS ) Tmax 38 Tmax Programming Guide (UCS)"

Transcription

1 Tmax Programming Guide ( UCS ) : TMUCS : Tmax 38 : FEB 19, 2003 : SEP 20, 2003

2 Tmax Programming Guide ( UCS ) Tmax 38 Tmax Programming Guide (UCS)

3 Copyright (c) 2001 Tmax Soft Co, Ltd All Rights Reserved,,, Tmax Soft,,, Tmax, WebT, WebtoB, JEUS, Host-Link, WebInOne Tmax Soft Co, Ltd Tmax Tel: , 2006 Fax: Tmax UCS Manual Document Edition Date Version TMUCS JUL 5, 2001 Tmax 38 Tmax Tmax Base, Tmax Standard, Options Tmax Standard Tmax Standard Tmax Options TP Function + 2 Phase Commit Web Admin Console, X25 Gateway, TCP/IP Gateway, Host-Link, Power Builder Interface Module, SERIAL Gateway, TCP/IP Service Gateway Tmax Programming Guide (UCS)

4 Tmax UCS Manual / UCS(User Control Server) RDP(Realtime Data Procesor) API UCS/RDP / (TCS ) UCS/RDPTCS Tmax system? Server, Database System Sample? 1 : Tmax UCS/RDP,, 2 : UCS/RDP, 3 : UCS UCS 4 Sample: UCS Client Server Sample Tmax Getting Started Guide Tmax Programming Guide ( C ) Tmax Reference Manual Tmax Programming Guide (UCS)

5 [ ] ( ) Numeric String Literal abc abc Tmax Programming Guide (UCS)

6 1 UCS (User Control Server) RDP(Real Data Processor) 8 11 Process Control TCS (Tmax Control Server) POD(Process On Demand) UCS (User Control Server) 9 12 UCS RDP(Real Data Processor) 12 2 UCS UCS UCS Server Program UCS Client Program RDP Server Program 34 3 UCS UCS RDP UCS RDP 39 4 UCS (core) socket RQ UCS UCS UCS UCS RDP RDP UCS 76 tpclrfd 76 tpissetfd 77 tpgetunsol 78 tppost 80 tpregcb 81 tprelay 82 tpsavectx 83 tpschedule 84 tpsendtocli 85 tpsetfd 87 Tmax Programming Guide (UCS)

7 tpsetunsol 88 tpsetunsol_flag 89 tpsubscribe 90 tpsvctimeout 92 tpsvrdown 93 tpunregcb 94 tpunsubscribe 95 tpuschedule 96 Tmax Programming Guide (UCS)

8 Tmax Programming Guide ( UCS ) Tmax Programming Guide (UCS)

9 1 UCS (User Control Server) RDP(Real Data Processor) UCS (User Control Server),, User Tmax UCS, UCS ( ), (UCS ), (, notify),, 11 Process Control TmaxTCS(Tmax Control Server) TypeUCS(User Control Server) Type Process Control TmaxTCS(Tmax Contorl Server), POD(Process On Demand) UCS(User Control Server) TypeProcess Control TCS Middleware(Tuxedo, Entera, TopEnd) request Process Control, POD request Process Control UCSTCS, POD Process Control Process Control TCS, POD Process UCS Process request, UCSTP MonitorTmax 111 TCS (Tmax Control Server) TCS Process 3-Tier Server Process Tmax System request Server ProcessService, Server ProcessService TCS TypeServer Program Tmax Programming Guide (UCS)

10 main() Signal tpsvrinit() ( ) request requestuser tpsvrdone() User 112 POD(Process On Demand) POD ProcessTCS Process Tmax Tmax 113 UCS (User Control Server) TCS Process, request Process UCS Process request,, request UCS TypeServer Program main() Signal tpsvrinit() usermain() tpsvrdone() usermain() Tmax Programming Guide (UCS)

11 ( ) tpschedule() : : Request User Tmax Programming Guide (UCS)

12 12 UCS UCS UserControl Server,, (,, )UCS Tmax ( ) UCS, ( ) 1),,, 2) software, end user 3), ( ) 1) batch, 1), (, check looping CPU, ) UCS Type UCS, Tmax Programming Guide (UCS)

13 13 RDP(Real Data Processor) RDPUCS RDP UCS RDPCLH UCS RDP RDP RDP (RSCPC) CLHRDP ( MINMAX ) RDP MIN, MAXCLH 2 CLHMINCLH, MAXCLH Tmax Programming Guide (UCS)

14 2 UCS UCS Programusermain, UCS Library (libsvrucsa / libsvrucsso) usermain() loop, usermain() ( ), tpsvrdone(), usermain() main() (main() ) UCS Program usermain() loop tpschedule() tpschedule() tmax kernel usermain() +1 #include <stdioh> +2 #include <usrinc/atmih> +3 #include <ucrinc/ucsh> #define MAX_CLI int num_cli; +7 int client_id[max_cli]; +8 int count; int +11 tpsvrinit(int argc, char *argv[]) num_cli = 0; +14 count = 0; int +17 usermain(int argc, char *argv[]) /* tmaxucs main */ int jobs; +20 int i; +21 int ret; +22 char *sndbuf; +23 static int count = 0; printf("usermain start\n"); sndbuf = (char *)tpalloc("carray", NULL, 1024); while(1) +30 for (i = 0; i < num_cli; i++) +31 sprintf(sndbuf, "Success tpsendtocli [%d] \n", count); +32 tpsendtocli (client_id[i], sndbuf, 1024, 0); count++; +35 sleep(1); +36 jobs = tpschedule(-1); Tmax Programming Guide (UCS)

15 LOGIN(TPSVCINFO *msg) /* tmaxservice */ char *sndbuf; +43 int clid; +44 int ret; +45 int i; printf("msg->data = [%*s]\n", msg->len, msg->data); +48 fflush(stdout); sndbuf = (char *)tpalloc("carray", NULL, 1024); printf("success transaction"); +53 sprintf(sndbuf, "Success transaction"); if (num_cli < MAX_CLI) +56 client_id[num_cli] = tpgetclid(); +57 printf("client id(clid) = %d\n", client_id[num_cli]); +58 num_cli++; tpreturn(tpsuccess, 0, (char *)sndbuf, 1024, 0); +62 (1) tpsvrinit() usermain() (2) 30, num_cli 0, for (3) 36, tpschedule(), tmdown check (4), LOGIN SERVICE 40 tpschedule() (5) 56, tpgetclid() client global client_id num_cli (6) 61, LOGIN SERVICE (7) 36, tpschedule() (8) 30, num_cli for (9) 32, tpsendtocli() client_id ( ) (10) (3) ~ (9) (11) tpschedule() tmdown, tpsvrdone() Tmax Programming Guide (UCS)

16 21 UCS 211 UCS Server Program UCS Server Program $(TMAXDIR)/lib/libsvrucsa $(TMAXDIR)/lib/shared/libsvrucsso - Programmain() ucs api - UCS Program make link int tpsvrinit(int argc, char *argv[]) - Global, non-xa int tpsvrdone() - resource non-xa int usermain(int argc, char *argv[]) - applicationlogic - loop (usermain() return, tpsvrdone() ) - tmdown tpschedule() tpschedule()call, tmdown, tmdown i Tmax Programming Guide (UCS)

17 , UCS 1 1, usermain() tpschedule() call UCS Program, User, API (APIprototype $(TMAXDIR)/usrinc/ucsh ) APIprototype UCS Program API int tpschedule(int sec) int tpuschedule(int usec) API int tpsendtocli(int clid, char *data, long len, long flags) int tpgetclid(void) Non Tmax API int tpsetfd(void) int tpissetfd(void) int tpclrfd(void) int tpgetctx(ctx_t *ctxp) int tpcancelctx(ctx_t *ctxp) CTX_T *tpsavectx() int tprelay(char *svc, char *data, long len, long flags, CTX_T *ctxp); UCS tpacall( ) callback API int tpregcb(void) int tpunregcb(void) API (1) int tpschedule(int timeout) requesttmdown, timeout timout, -1 1 tperrno (timeout )tperrno 13(TPETIME) : int sec - : - 0 : - -1 : check,, : : - : - -1 :,,, timeout tperrno 13 check Tmax Programming Guide (UCS)

18 : #include <stdioh> #include <usrinc/atmih> #include <usrinc/ucsh> int tpsvrinit(int argc, char *argv[]) return 1; int tpsvrdone() return 1; int usermain(int argc, char *argv[]) int rcode, i; printf("usermain start\n"); while(1) rcode = tpschedule(1); printf( rcode = %d, i = %d, tperrno = %d\n, rcode, i, tperrno); i++; UCSTEST(TPSVCINFO *msg) /* tmaxservice */ printf( UCSTEST start!!\n ); tpreturn(tpsuccess, 0, msg->data, msg->len, 0); : - request : rcode = -1, i = 0, tperrno = 13 rcode = -1, i = 1, tperrno = 13 rcode = -1, i = 2, tperrno = 13 - request rcode = -1, i = 0, tperrno = 13 rcode = -1, i = 1, tperrno = 13 rcode = -1, i = 2, tperrno = 13 UCSTEST start!! /* request */ rcode =1, i=3, tperrno = 0 /* 1return */ rcode = -1, i = 4, tperrno = 13 (2) int tpuschedule(int usec) Tmax Programming Guide (UCS)

19 tpschedule(), microsecond (3) int tpsendtocli(int clid, char *data, long len, long flags) clid clid tpgetclid(), tpsendtocli()tpgetclid(),, - int clid : tpgetclid() -char *data : tpalloc - long len : - long flags : flags 0 (Zero), networkbandwidth, fault TPUDP 0 flag, UDP TPFLOWCONTROL, 1 : : - 1 : - -1 :, tperrno error check : #include <stdioh> #include <usrinc/atmih> #include <usrinc/ucsh> int client_id[5]; int usermain(int argc, char *argv[]) int jobs; int i; char *sndbuf; Tmax Programming Guide (UCS)

20 static int count = 0; printf("usermain start\n"); sndbuf = (char *)tpalloc("carray", NULL, 1024); while(1) for (i = 0; i < 5; i++) if (client_id[i] < 0) continue; sprintf(sndbuf, "Success tpsendtocli [%d] \n", count); tpsendtocli (client_id[i], sndbuf, 1024, 0); count++; jobs = tpschedule(1); CONN_CLI(TPSVCINFO *msg) char *sndbuf; int i; sndbuf = (char *)tpalloc("carray", NULL, 1024); if (sndbuf == NULL) printf( tpalloc fail!!!\n, tperrno); tpreturn(tpfail, -1, NULL, 0, 0); for (i=0; i<5; i++) if (client_id[i] < 0) client_id[i] = tpgetclid(); break; strcpy(sndbuf, connect success!! ); tpreturn(tpsuccess, 0, (char *)sndbuf, strlen(sndbuf), 0); int tpsvrinit(int argc, char *argv[]) for (i=0; i<5; i++) client_id[i] = -1; return 1; int tpsvrdone() (4) int tpgetclid(void) reqeust tmax tpsendtocli() tpsendtocli() argumentclid : Tmax Programming Guide (UCS)

21 : : request (5) int tpsefd(int fd) tpschedule() Tmax request tmdown check, fd check FD_SET() tpclrfd(), tpissetfd() - int fd : socket fd : - 1 : - -1 :, tperrno check (6) int tpissefd(int fd) fd check FD_ISSET() tpsetfd(), tpclrfd() - int fd : socket fd : - 1 : - -1 :, tperrno check (7) int tpclrfd(int fd) socket fdtpschedule() check FD_CLR() tpsetfd(), tpissetfd() - int fd : socket fd : - 1 : - -1 :, tperrno check #include <stdioh> #include <stdlibh> #include <stringh> #include <unistdh> #include <fcntlh> #include <errnoh> #include <signalh> Tmax Programming Guide (UCS)

22 #include <sys/typesh> #include <sys/timeh> #include <sys/socketh> #include <sys/unh> #include <netinet/inh> #include <arpa/ineth> #include <netdbh> #include <usrinc/atmih> #include <usrinc/ucsh> #ifndef INADDR_NONE #define INADDR_NONE #endif 0xffffffff #define PORT 9345 #define HOST_ADDR " " #define MAX_BUFFER_LEN /* global variable */ int client_fd = -1; +30 /* service initial */ int tpsvrinit(int argc, char *argv[]) client_fd = network_connect(host_addr, PORT); if (client_fd > 0) /* connect socket fdtpschedule() */ tpsetfd(client_fd); int tpsvrdone() if (client_fd > 0) /* tpschedule socket fd */ tpclrfd(client_fd); close(client_fd); /* main */ int usermain(int argc, char *argv[]) int n; /* never return */ while(1) if (client_fd < 0) client_fd = network_connect(host_addr, PORT); if (client_fd > 0) tpsetfd(client_fd); else tpschedule(5); continue; Tmax Programming Guide (UCS)

23 if ((n = tpschedule(0)) < 0) sleep(1); continue; /* socket fddata */ if (tpissetfd(client_fd)) if ((n = request_from_client(client_fd)) < 0) tpclrfd(client_fd); close(client_fd); client_fd = -1; /* end of while */ /* client request */ int request_from_client(int fd) int n, len; char *ptr, buffer[max_buffer_len]; /* read header */ memset(buffer, 0x00, sizeof(buffer)); n = socket_read(fd, buffer, 4); if (n <= 0) return -1; len = atoi(buffer); /* read data */ n = socket_read(fd, &buffer[4], len); if (n <= 0) return -1; sleep(3); len += 4; n = socket_write(fd, buffer, len); return n; /* client connect for TCP/IP */ int network_connect(char *host, int port) struct sockaddr_in serv_addr; unsigned long inaddr; struct hostent *hp; int i, fd; memset((char *) &serv_addr, 0, sizeof(serv_addr)); serv_addrsin_family = AF_INET; serv_addrsin_port = htons(port); if ((inaddr = inet_addr(host))!= INADDR_NONE) memcpy((char *) &serv_addrsin_addr, (char *) &inaddr, sizeof(inaddr)); Tmax Programming Guide (UCS)

24 else if ((hp = gethostbyname(host)) == NULL) return -1; memcpy((char *) &serv_addrsin_addr, hp->h_addr, hp->h_length); if ((fd = socket(af_inet, SOCK_STREAM, 0)) < 0) return -1; if (connect(fd, (struct sockaddr *) &serv_addr, sizeof(serv_addr)) >= 0) return fd; close(fd); return -1; /* data read */ int socket_read(int fd, char *ptr, int nbytes) int nleft, nread; char *ptr2; ptr2 = (char *)ptr; nleft = nbytes; while (nleft > 0) nread = recv(fd, ptr, nleft, 0); if (nread < 0) if (errno == EINTR) continue; else if (errno == EWOULDBLOCK) return (nbytes - nleft); return(nread); /* error, return < 0 */ else if (nread == 0) break; /* EOF */ nleft -= nread; ptr += nread; return (nbytes - nleft); /* return >= 0 */ /* data write */ int socket_write(int fd, char *ptr, int nbytes) int nleft, nwritten; nleft = nbytes; while (nleft > 0) nwritten = send(fd, ptr, nleft, 0); if (nwritten <= 0) return(nwritten); /* error */ nleft -= nwritten; ptr += nwritten; return(nbytes - nleft); Tmax Programming Guide (UCS)

25 (8) int tpgetctx(ctx_t *ctxp), client transaction CTX_T structure tpsavectx(), ctxpreferenceuser, library tpgetctx()userreference ctxp tpsavectx(), tpgetctx() tpgetctx() CTX_T * : : - CTX_T *ctxp : client transaction structure - 1 : - -1 :, tperrno check (9) int tpcancelctx(ctx_t *ctxp) library : : - CTX_T *ctxp : client transaction structure - 1 : - -1 :, tperrno check (10) CTX_T *tpsavectx(), client transaction CTX_T structure tpgetctx(), ctxpreferenceuser, library tpsavectx() library reference ctxp tpsavectx(), tpgetctx() : : - CTX_T *ctxp : client transaction structure - NULL : (11) int tprelay(char *svc, char *data, long len, long flags, CTX_T *ctxp) tpforward() UCS tpsavectx() client transaction,, tpsavectx() client transaction UCS Tmax Programming Guide (UCS)

26 block, tpforward(), tprelay() : - char *svc : service - char *data : - long len : - long flags - CTX_T *ctxp: client transaction structure : - 1 : --1 : #include <stdioh> #include <stdlibh> #include <stringh> #include <unistdh> #include <fcntlh> #include <errnoh> #include <signalh> #include <sys/typesh> #include <sys/timeh> #include <sys/socketh> #include <sys/unh> #include <netinet/inh> #include <arpa/ineth> #include <netdbh> #include <usrinc/atmih> #include <usrinc/ucsh> #ifndef INADDR_NONE #define INADDR_NONE #endif 0xffffffff #define MAX_CLIENT 10 #define PORT 9345 #define MAX_BUFFER_LEN 4096 struct myinfo_t int fd; char unique_id[10]; CTX_T *ctx; ; typedef struct myinfo_t MYINFO; /* global variable */ int listen_fd = -1; Tmax Programming Guide (UCS)

27 int client_fd = -1; int portno; MYINFO *myinfo; /* service initial */ int tpsvrinit(int argc, char *argv[]) listen_fd = network_listen(portno); if (listen_fd > 0) tpsetfd(listen_fd); client_init(); int tpsvrdone() if (listen_fd > 0) tpclrfd(listen_fd); close(listen_fd); /* client initial */ int client_init() int i, len; len = sizeof(myinfo) * MAX_CLIENT; myinfo = (MYINFO *)malloc(len); for (i = 0; i < MAX_CLIENT; i++) myinfo[i]fd = -1; myinfo[i]ctx = NULL; /* main */ int usermain(int argc, char *argv[]) int n; /* never return */ while(1) if (listen_fd < 0) listen_fd = network_listen(port); if (listen_fd > 0) tpsetfd(listen_fd); else tpschedule(5); continue; if ((n = tpschedule(0)) < 0) sleep(1); continue; Tmax Programming Guide (UCS)

28 /* check listen port */ if (tpissetfd(listen_fd)) if ((client_fd = network_accept(listen_fd)) < 0) tpclrfd(listen_fd); close(listen_fd); listen_fd = -1; else tpsetfd(client_fd); continue; /* check client port */ if (tpissetfd(client_fd)) if (client_response(client_fd) < 0) tpclrfd(client_fd); close(client_fd); client_fd = -1; /* end of while */ /* service */ UCS_TEST(TPSVCINFO *msg) int i, n; CTX_T *ctx; printf("ucs_test : 12345\n"); ctx = (CTX_T *)tpsavectx(); for (i = 0; i < MAX_CLIENT; i++) if (myinfo[i]fd < 0) myinfo[i]fd = client_fd; memcpy(myinfo[i]unique_id, msg->data, 6); myinfo[i]ctx = ctx; break; n = message_write(client_fd, msg->data, msg->len); if (n < 0) tpclrfd(client_fd); close(client_fd); client_fd = -1; tpreturn(tpfail, 999, (char *)NULL, 0, 0); tpreturn(tpsuccess, 0, (char *)NULL, 0, 0); /* message write */ int message_write(int fd, char *data, long datalen) int n, len; Tmax Programming Guide (UCS)

29 char char buffer[max_buffer_len]; temp[10]; memcpy(&buffer[4], data, datalen); sprintf(temp, "%04d", datalen); memcpy(buffer, temp, 4); len = datalen + 4; n = socket_write(fd, buffer, len); printf("ucs_listen:socket-write = %d\n", n); return n; /* client response */ int client_response(int fd) int i, n, len; CTX_T *ctx; char *ptr, buffer[max_buffer_len]; /* read header */ memset(buffer, 0x00, sizeof(buffer)); n = socket_read(fd, buffer, 4); if (n <= 0) return -1; len = atoi(buffer); printf("ucs_listen:length : %d\n", len); /* client memory alloc */ ptr = (char *)tpalloc("carray", "", len+10); if (ptr == NULL) return -1; /* read data */ n = socket_read(fd, ptr, len); if (n <= 0) tpfree(ptr); return -1; for (i = 0; i < MAX_CLIENT; i++) if (myinfo[i]fd < 0) continue; if (memcmp(myinfo[i]unique_id, ptr, 6) == 0) ctx = myinfo[i]ctx; myinfo[i]fd = -1; myinfo[i]ctx = NULL; break; if (i >= MAX_CLIENT) return 0; printf("ucs_listen:tprelay before: length = %d\n", n); n = tprelay("xa_tolower", ptr, (long)n, 0, ctx); Tmax Programming Guide (UCS)

30 if (n < 0) printf("ucs_listen:tprelay failed: tperrno=%d\n", tperrno); printf("ucs_listen:tprelay ok\n"); tpfree(ptr); return 0; /* server : listen */ int network_listen(int portno) int fd; int on; struct sockaddr_in serv_addr; if ((fd = socket(af_inet, SOCK_STREAM, 0)) < 0) return(-1); on = 1; if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (char *) &on, sizeof(on)) < 0) printf("setsockopt error for SO_REUSEADDR"); memset((char *) &serv_addr, 0, sizeof(serv_addr)); serv_addrsin_family = AF_INET; serv_addrsin_addrs_addr = htonl(inaddr_any); serv_addrsin_port = htons(portno); if (bind(fd, (struct sockaddr *) &serv_addr, sizeof(serv_addr)) < 0) close(fd); return(-2); if (listen(fd, 250) < 0) close(fd); return(-3); return(fd); /* server : client accept */ int network_accept(int listenfd) int fd, len; struct sockaddr_in cli_addr; len = sizeof(cli_addr); fd = accept(listenfd, (struct sockaddr *)&cli_addr, &len); if (fd < 0) return(-1); /* often errno=eintr, if signal caught */ return(fd); Tmax Programming Guide (UCS)

31 /* data write */ int socket_write(int fd, char *ptr, int nbytes) int nleft, nwritten; nleft = nbytes; while (nleft > 0) nwritten = send(fd, ptr, nleft, 0); if (nwritten <= 0) return(nwritten); /* error */ nleft -= nwritten; ptr += nwritten; return(nbytes - nleft); /* data read */ int socket_read(int fd, char *ptr, int nbytes) int nleft, nread; char *ptr2; ptr2 = (char *)ptr; nleft = nbytes; while (nleft > 0) nread = recv(fd, ptr, nleft, 0); if (nread < 0) if (errno == EINTR) continue; else if (errno == EWOULDBLOCK) return (nbytes - nleft); return(nread); /* error, return < 0 */ else if (nread == 0) break; /* EOF */ nleft -= nread; ptr += nread; return (nbytes - nleft); /* return >= 0 */ (11) int tpregcb(void) UCS UCS tpgetreply(), tpacall() tpgetreply() tpregcb() callback : : Tmax Programming Guide (UCS)

32 - 1 : - -1 : 212 UCS Client Program UCS Program Service Client Program, UCS Program Data, UCS Program Data Client Program UCS Program Data tpsetunsol_flag(), tpsetunsol(), tpgetunsol() tpsetunsol_flag()tpstart() Tmax System flag flag API (1) int tpsetunsol_flag(int flag) flag tpsetunsol_flag()tpstart() Tmax flag flag flagsms TPUNSOL_IGN, TPUNSOL_HND, TPUNSOL_POLL 3 TPUNSOL_IGN flag, TPUNSOL_HNDTPUNSOL_POLL : int flag - TPUNSOL_IGN : - TPUNSOL_HND : - TPUNSOL_POLL : : - 1 : --1 : (2) Unsolfunc tpsetunsol(void (*disp)(char *data, long len, long flags)) tpsetunsol() Tmax tpsetunsol(), Tmax NULL tpsetunsol(), tpsetunsol() data, len flags, datanull Tmax Programming Guide (UCS)

33 data, data, return : : - : - TPUNSOLERR : (3) int tpgetunsol(int type, char **data, long *len, long flags) tpgetunsol() tpbroadcast() tpsendtocli(), tppost() tpgetunsol() tpgetunsol(), tpstart() Tmax flagstpunsol_polltpunsol_hnd tpgetunsol() tpstart() TPUNSOL_IGN TPUNSOL_POLL : - int type * UNSOL_TPPOST : tppost() * UNSOL_TPBROADCAST : tpbroadcast() * UNSOL_TPSENDTOCLI : tpsendtocli() - int flags * TPBLOCK : * TPNOTIME : : - char **data : - long *len : - 1 : --1: #include <stdioh> #include <usrinc/atmih> #include <usrinc/ucsh> main(int argc, char *argv[]) char *sndbuf; char *rcvbuf; long rcvlen; int RecvCnt = 0; Tmax Programming Guide (UCS)

34 if(tpstart((tpstart_t *)NULL) == -1) printf("tpstart failed[%s]\n",tpstrerror(tperrno)); exit(-1); tpsetunsol_flag(tpunsol_poll); if((sndbuf = (char *)tpalloc("carray", NULL, 1024)) == NULL) printf("sndbuf failed\n"); tpend(); exit(-1); if((rcvbuf = (char *)tpalloc("carray", NULL, 1024)) == NULL) printf("rcvbuf failed\n"); tpfree((char *)sndbuf); tpend(); exit(-1); if(tpcall("login", sndbuf, 1024, &rcvbuf, &rcvlen, 0) == -1) printf("can't send request to service LOGIN\n"); tpfree((char *)sndbuf); tpfree((char *)rcvbuf); tpend(); exit(1); printf("after tpcall() received Message from server:%s\n", rcvbuf); while(1) tpgetunsol(unsol_tpsendtocli, &rcvbuf, &rcvlen, TPBLOCK); printf("loop Count : %d\n", RecvCnt); if(rcvlen > 0) printf("counter : %d #[Received Data from Server : %s]\n ", RecvCnt, rcvbuf); RecvCnt ++; Tmax Programming Guide (UCS)

35 213 RDP Server Program RDP Server Program UCS Programusermain() application logic RDP Server Program $(TMAXDIR)/lib/libsvrrs so - Programmain() RDP api - RDP Program compile link int tpsvrinit(int argc, char *argv[]) - Global, non-xa int tpsvrdone() - resource non-xa int usermain(int argc, char *argv[]) - applicationlogic - loop (usermain() return, tpsvrdone() ) - UCS Server Program RDP Server Program tpschedule() RDP Client ProgramUCS Client Program tpsetunsol_flag(), tpsetunsol(), tpgetunsol() API 212 UCS Client Program Tmax Programming Guide (UCS)

36 3 UCS 31 UCS SERVER SVGNAME SVRTYPE UCS UCS *DOMAIN tmax1 *NODE tmaxs1 tmaxs2 *SVRGROUP svg1 svg2 *SERVER ucssvr1 ucssvr2 *SERVICE SVC1 SHMKEY =79970, MINCLH=1, MAXCLH=3, TPORTNO=8844, BLOCKTIME=120, RACPORT=3443 TMAXDIR = "/user1/jaya/tmax3511", APPDIR = "/user1/jaya/tmax3511/appbin", PATHDIR = "/user1/jaya/tmax3511/path", TLOGDIR = "/user1/jaya/tmax3511/log/tlog", ULOGDIR = "/user1/jaya/tmax3511/log/ulog", SLOGDIR = "/user1/jaya/tmax3511/log/slog" TMAXDIR = "/user/jaya/tmax3511", APPDIR = "/user/jaya/tmax3511/appbin", PATHDIR = "/user/jaya/tmax3511/path", TLOGDIR = "/user/jaya/tmax3511/log/tlog", ULOGDIR = "/user/jaya/tmax3511/log/ulog", SLOGDIR = "/user/jaya/tmax3511/log/slog" NODENAME = "tmaxs1" NODENAME = "tmaxs2" SVGNAME = svg1, SVRTYPE = UCS, CPC = 5 SVGNAME = svg2, SVRTYPE = UCS # UCSCLH # UCS TCS TypeService SVRNAME = ucssvr1 Tmax Programming Guide (UCS)

37 32 RDP RDP DOMAINMINCLH MAXCLH NODE REALSVR Real Server rscpc Real Server Real Server Real Server Real Server Channel rscpc SERVER MINMAX DOMAIN MINCLHMAXCLH ( 2 ) SVRTYPE=REALSVR *DOMAIN tmax1 *NODE tmaxi1 SHMKEY =70990, MINCLH=2, MAXCLH=2 TMAXDIR = "/home/navis/tmax", APPDIR = "/home/navis/tmax/appbin", PATHDIR = "/home/navis/tmax/path", TLOGDIR = "/home/navis/tmax/log/tlog", ULOGDIR = "/home/navis/tmax/log/ulog", SLOGDIR = "/home/navis/tmax/log/slog", REALSVR = real", rscpc = 16 *SVRGROUP svg1 svg2 NODENAME = "tmaxi1" NODENAME = "tmaxi1" *SERVER deal real SVGNAME = svg2, MIN=1 SVGNAME = svg1, MIN=1, MAX=1, SVRTYPE = REALSVR, *SERVICE IN OUT SVRNAME = deal SVRNAME = deal Tmax Programming Guide (UCS)

38 33 UCS UCS Server Program UCS Library(libsvrucsa libsvrucsso) $TMAXDIR/usrinc/ucsh include, Makefile TMAXLIBS -lsvrucs UCS Server ProgramMakefile ( OS32bit Solaris, OS Makefile ) # Server makefile TARGET = $(COMP_TARGET) APOBJS = $(TARGET)o SDLFILE = demos #Solaris LIBS = -lsvrucs -lsocket lnsl -nodb # OS #LIBS = -lsvrucs -nodb OBJS = $(APOBJS) $(SDLOBJ) $(SVCTOBJ) SDLOBJ = $SDLFILE:s=_sdlo SDLC = $SDLFILE:s=_sdlc SVCTOBJ = $(TARGET)_svctabo CFLAGS = -O -I$(TMAXDIR) APPDIR = $(TMAXDIR)/appbin SVCTDIR = $(TMAXDIR)/svct LIBDIR = $(TMAXDIR)/lib # SUFFIXES : c co: $(CC) $(CFLAGS) -c $< # # server compile # $(TARGET): $(OBJS) $(CC) $(CFLAGS) -L$(LIBDIR) -o $(TARGET) $(OBJS) $(LIBS) mv $(TARGET) $(APPDIR)/ rm -f $(OBJS) Tmax Programming Guide (UCS)

39 $(APOBJS): $(TARGET)c $(CC) $(CFLAGS) -c $(TARGET)c $(SVCTOBJ): touch $(SVCTDIR)/$(TARGET)_svctabc $(CC) $(CFLAGS) -c $(SVCTDIR)/$(TARGET)_svctabc $(SDLOBJ): $(TMAXDIR)/bin/sdlc -i /sdl/$(sdlfile) $(CC) $(CFLAGS) -c /sdl/$(sdlc) # clean: -rm -f *o core $(TARGET) Tmax Programming Guide (UCS)

40 34 RDP RDP Server Program RDP Library(libsvrrsso) $TMAXDIR/usrinc/ucsh include, Makefile TMAXLIBS lsvrrs lpthread RDP Server ProgramUCS Makefile ( OS32bit Solaris, OS Makefile ) # Server makefile TARGET = $(COMP_TARGET) APOBJS = $(TARGET)o SDLFILE = demos #Solaris LIBS = -lsvrrs -lpthread -lnodb -lsocket -lnsl OBJS = $(APOBJS) $(SDLOBJ) $(SVCTOBJ) SDLOBJ = $SDLFILE:s=_sdlo SDLC = $SDLFILE:s=_sdlc SVCTOBJ = $(TARGET)_svctabo CFLAGS = -O -I$(TMAXDIR) APPDIR = $(TMAXDIR)/appbin SVCTDIR = $(TMAXDIR)/svct LIBDIR = $(TMAXDIR)/lib # SUFFIXES : c co: $(CC) $(CFLAGS) -c $< # # server compile # $(TARGET): $(OBJS) $(CC) $(CFLAGS) -L$(LIBDIR) -o $(TARGET) $(OBJS) $(LIBS) mv $(TARGET) $(APPDIR)/ rm -f $(OBJS) $(APOBJS): $(TARGET)c Tmax Programming Guide (UCS)

41 $(CC) $(CFLAGS) -c $(TARGET)c $(SVCTOBJ): touch $(SVCTDIR)/$(TARGET)_svctabc $(CC) $(CFLAGS) -c $(SVCTDIR)/$(TARGET)_svctabc $(SDLOBJ): $(TMAXDIR)/bin/sdlc -i /sdl/$(sdlfile) $(CC) $(CFLAGS) -c /sdl/$(sdlc) # clean: -rm -f *o core $(TARGET) Tmax Programming Guide (UCS)

42 4 UCS UCS UCS 41 (core) ucs_svr1c (core) file directory move #include <stdioh> #include <stdlibh> #include <unistdh> #include <timeh> #include <sys/timeh> #include <sys/typesh> #include <direnth> #include <fcntlh> #include <usrinc/atmih> char _file_path[100]; int _cliid[10]; int tpsvrint(int argc, char *argv[]) return 0; int tpsvrdone() return 0; int usermain(int argc, char *argv[]) int iret, i; char core_file[50]; char server_name[50]; Tmax Programming Guide (UCS)

43 char cur_time[20]; char *str; /* init cliid */ for (i=0; i<10; i++) _cliid[i] = -1; strcpy(_file_path, argv[1]); sprintf(core_file, "%s/core", _file_path); while(1) tpschedule(5); iret = checkcorefile(); if (iret == 1) iret = getcorename(core_file, server_name); iret = getcurrenttime(cur_time); iret = movecorefile(core_file, server_name, cur_time); str = (char *)tpalloc("string", NULL, 0); sprintf(str, "%s program core!!", server_name); for (i=0; i<10; i++) if (_cliid[i] < 0) continue; iret = tpsendtocli(_cliid[i], str, strlen(str), 0); if (iret == -1) printf("client close connect!!\n"); _cliid[i] = -1; for (i=0; i<10; i++) printf("cliid = %d - %d\n", i, _cliid[i]); tpfree(str); int checkcorefile() char server_name[50]; char core_file[100]; struct dirent *dirent; DIR *dp; Tmax Programming Guide (UCS)

44 dp = opendir(_file_path); if (dp == NULL) printf("%s directory is not found!\n", _file_path); return -1; for (dirent = readdir(dp); dirent!= NULL; dirent = readdir(dp)) if ( (strlen(dirent->d_name) == 4) && (strncmp(dirent->d_name, "core", 4) == 0)) closedir(dp); return 1; closedir(dp); return -1; int getcorename(char *filename, char *server) int fd, cnt, i; char buf[6000]; fd = open(filename, O_RDONLY); #ifdef _HP cnt = read(fd, buf, 144); #endif #ifdef _SUN cnt = read(fd, buf, 132); #endif #ifdef _IBM cnt = read(fd, buf, 1759); #endif cnt = read(fd, buf, 1760); while(1) cnt = read(fd, buf, 1); if (cnt!= 1) return -1; *server++ = buf[0]; if (buf[0] == 0) break; Tmax Programming Guide (UCS)

45 close(fd); int getcurrenttime(char *cur_time) struct tm *tm; time_t tnow; time(&tnow); tm = localtime(&tnow); sprintf(cur_time, "%04d%02d%02d%02d%02d%02d", tm->tm_year+1900, tm->tm_mon+1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec); return 0; int movecorefile(char *core, char *server, char *time) char cmd[100]; char file_name[50]; printf("server = [%s]\n", server); sprintf(file_name, "core_%s_%s", server, time); sprintf(cmd, "mv %s %s/%s", core, _file_path, file_name); system(cmd); return 0; CONN_TERM(TPSVCINFO *msg) int i; char *stdata; stdata = (char *)msg->data; for (i=0; i<10; i++) if (_cliid[i] >= 0) continue; _cliid[i] = tpgetclid(); printf("connect client %d = %d\n", i, _cliid[i]); Tmax Programming Guide (UCS)

46 break; tpreturn(tpsuccess, 0, (char *)stdata, 0, 0); Tmax Programming Guide (UCS)

47 42 socket ucs_svr2c client socketaccept, acceptsocket tpacall client ucs_svr2c usermain() #include <stdioh> #include <stdlibh> #include <stringh> #include <unistdh> #include <fcntlh> #include <errnoh> #include <signalh> #include <sys/typesh> #include <sys/timeh> #include <sys/socketh> #include <sys/unh> #include <netinet/inh> #include <arpa/ineth> #include <netdbh> #include <usrinc/atmih> #include <usrinc/ucsh> #ifndef INADDR_NONE #define INADDR_NONE #endif 0xffffffff #define CLIENT_PORT 9345 #define HOST_ADDR " " #define MAX_BUFFER_LEN 4096 /* global variable */ int client_fd = -1; char ip_addr[30]; int portno; extern int _cur_clhfd; /* service initial */ tpsvrinit(int argc, char *argv[]) sleep(5); parse_args(argc, argv); Tmax Programming Guide (UCS)

48 client_fd = network_connect(ip_addr, portno); if (client_fd > 0) tpsetfd(client_fd); printf("ucs_sample:client_fd = %d\n", client_fd); printf("ucs_sample: _cur_clhfd(1) = %d\n", _cur_clhfd); tpsvrdone() if (client_fd > 0) tpclrfd(client_fd); close(client_fd); /* main */ int usermain(int argc, char *argv[]) int n; /* never return */ while(1) if (client_fd < 0) client_fd = network_connect(ip_addr, portno); if (client_fd > 0) tpsetfd(client_fd); else tpschedule(5); continue; printf("ucs_sample:client_fd = %d\n", client_fd); printf("ucs_sample: _cur_clhfd(1) = %d\n", _cur_clhfd); if ((n = tpschedule(0)) < 0) sleep(1); continue; printf("ucs_sample: _cur_clhfd(2) = %d\n", _cur_clhfd); if (tpissetfd(client_fd)) if ((n = request_from_client(client_fd)) < 0) Tmax Programming Guide (UCS)

49 tpclrfd(client_fd); close(client_fd); client_fd = -1; /* command argument */ int parse_args(int argc, char *argv[]) int c; portno = -1; memset(ip_addr, 0x00, sizeof(ip_addr)); opterr = 0; /* don't want getopt() writing to stderr */ while ((c = getopt(argc, argv, "i:p:"))!= EOF) switch (c) case 'p': /* port */ portno = atoi(optarg); break; case 'i': /* ip-addr */ strcpy(ip_addr, optarg); break; case '?': printf("unrecognized option: -%c", optopt); /* default value: portno, shared memory key */ if (portno <= 0) portno = CLIENT_PORT; printf("no PORT is set: assumed %d\n", portno); if (ip_addr[0] == 0x00) strcpy(ip_addr, HOST_ADDR); printf("no IP-ADDR is set: assumed %s\n", ip_addr); return 1; Tmax Programming Guide (UCS)

50 /* client request */ int request_from_client(int fd) int n, len; char *ptr, buffer[max_buffer_len]; /* read header */ memset(buffer, 0x00, sizeof(buffer)); n = socket_read(fd, buffer, 4); if (n <= 0) return -1; len = atoi(buffer); printf("ucs_sample:length : %d\n", len); /* read data */ n = socket_read(fd, &buffer[4], len); if (n <= 0) return -1; sleep(3); len += 4; n = socket_write(fd, buffer, len); printf("ucs_sample:socket write : n=%d\n", n); return n; /* client connect for TCP/IP */ int network_connect(char *host, int port) struct sockaddr_in serv_addr; unsigned long inaddr; struct hostent *hp; int i, fd; memset((char *) &serv_addr, 0, sizeof(serv_addr)); serv_addrsin_family = AF_INET; serv_addrsin_port = htons(port); /* First try to convert the host name as a dotted-decimal number * Only if that fails do we call gethostbyname() */ if ((inaddr = inet_addr(host))!= INADDR_NONE) Tmax Programming Guide (UCS)

51 /* it's dotted-decimal */ memcpy((char *) &serv_addrsin_addr, (char *) &inaddr, sizeof(inaddr)); else if ((hp = gethostbyname(host)) == NULL) printf("host name error: %s\n", host); return(-1); memcpy((char *) &serv_addrsin_addr, hp->h_addr, hp->h_length); if ((fd = socket(af_inet, SOCK_STREAM, 0)) < 0) printf("can't open stream socket\n"); return -1; if (connect(fd, (struct sockaddr *) &serv_addr, sizeof(serv_addr)) >= 0) return fd; close(fd); return -1; /* data read */ int socket_read(int fd, char *ptr, int nbytes) int nleft, nread; char *ptr2; ptr2 = (char *)ptr; nleft = nbytes; while (nleft > 0) nread = recv(fd, ptr, nleft, 0); if (nread < 0) if (errno == EINTR) continue; else if (errno == EWOULDBLOCK) return (nbytes - nleft); return(nread); /* error, return < 0 */ else if (nread == 0) break; /* EOF */ nleft -= nread; ptr += nread; Tmax Programming Guide (UCS)

52 return (nbytes - nleft); /* return >= 0 */ /* data write */ int socket_write(int fd, char *ptr, int nbytes) int nleft, nwritten; nleft = nbytes; while (nleft > 0) nwritten = send(fd, ptr, nleft, 0); if (nwritten <= 0) return(nwritten); /* error */ nleft -= nwritten; ptr += nwritten; return(nbytes - nleft); Tmax Programming Guide (UCS)

53 43 RQ ucs_svr3c fail queue datadequeue call #include <sys/typesh> /* required for some of our prototypes */ #include <stdioh> #include <stdlibh> #include <stringh> #include <unistdh> #include <fcntlh> #include #include #include #include #include #include #include <sys/socketh> <sys/stath> <sys/unh> <netinet/inh> <arpa/ineth> <usrinc/atmih> <usrinc/tmaxapih> #define MAX_BUF_SZ #define SZ 100 #define QUEFILE "rq1" #define QUESERVICE "+fail" int usermain(int argc, char*argv[]) char svc[xatmi_service_name_length]; long len, n; int try, ifailcnt; char *ptr; char QueFile[SZ]; char QueService[SZ]; strcpy(quefile, QUEFILE); strcpy(queservice, QUESERVICE); ptr = (char *)tpalloc("carray", NULL, MAX_BUF_SZ); while (1) /* Endless Loop */ tpschedule(10); /* Sleep 10 seconds */ n = 0; Tmax Programming Guide (UCS)

54 try = 0; ifailcnt = tpqstat(quefile, TMAX_FAIL_QUEUE); #ifdef _DEBUG printf("\ntpqstat FailCount value = [%d]\n", ifailcnt); #endif while( (n >= 0) && (try++ < ifailcnt ) ) n = tpdeq(quefile, QueService, &ptr, &len, TPRQS ); #ifdef _DEBUG printf("tpdeq n value = [%s] \n", tpstrerror(n)); #endif if (n < 0 ) if (tperrno == TPEMATCH) /* Fail Q empty */ ; else printf("tpdeq fail[%s]\n", tpstrerror(tperrno)); continue; n = tpextsvcname((char*)ptr, svc); #ifdef _DEBUG printf("tpextsvcname value = [%s]\n", svc); #endif if (n < 0) printf("tpextsvcname fail![%s]\n", tpstrerror(tperrno)); continue; n = tpenq(quefile, svc, (char*)ptr, len, TPRQS); #ifdef _DEBUG printf("tpenq n value = [%d]\n", n); #endif if (n < 0) printf("tpenq fail![%s]\n", tpstrerror(tperrno)); continue; return 1; Tmax Programming Guide (UCS)

55 5 51 UCS UCS UCS * -- RQ Tmax * POS -- RQ DB * -- FireWall Disconnect, Applet Connect Tmax LOGIN Heart Bit Session * HTS ( ) -- * ARS requestsocket Tmax call -- ARS TCP/IP, ARS MessageTmax Server ARS * ServerTCP/IP, RQ UCS Tmax Programming Guide (UCS)

56 52 UCS 521 UCS UCS Loop LOGIN UCS Config File *DOMAIN tmax1 SHMKEY =79970, MINCLH=1, MAXCLH=3, TPORTNO=8844, BLOCKTIME=120 *NODE tmaxs2 TMAXDIR = "/user/jaya/tmax3511", APPDIR = "/user/jaya/tmax3511/appbin", PATHDIR = "/user/jaya/tmax3511/path", TLOGDIR = "/user/jaya/tmax3511/log/tlog", ULOGDIR = "/user/jaya/tmax3511/log/ulog", SLOGDIR = "/user/jaya/tmax3511/log/slog" *SVRGROUP tmaxs2_nx NODENAME = "tmaxs2" *SERVER ucs_server SVGNAME = tmaxs2_nx, SVRTYPE = UCS *SERVICE LOGIN SVRNAME = ucs_server Client Program Client Program tpstart() LOGIN tpcall(), UCS Client Program tpsetunsol_flag(tpunsol_poll); Client Program sndbuf "Client Registration Success" rcvbuf Tmax Programming Guide (UCS)

57 printf("after tpcall() received Message from server:%s\n", rcvbuf); Client loop count, count for loop sndbuf Success tpsendtocli [0] Client while loop Loop count while(1) tpgetunsol(unsol_tpsendtocli, &rcvbuf, &rcvlen, TPBLOCK); printf("loop Count : %d\n", RecvCnt); if(rcvlen > 0) printf("counter : %d #[Received Data from Server : %s]\n ", RecvCnt, rcvbuf); RecvCnt ++; #include <stdioh> #include <usrinc/atmih> #include <usrinc/ucsh> main(int argc, char *argv[]) char *sndbuf; char *rcvbuf; long rcvlen; int RecvCnt = 0; if(tpstart((tpstart_t *)NULL) == -1) error processing tpsetunsol_flag(tpunsol_poll); if((sndbuf = (char *)tpalloc("carray", NULL, 1024)) == NULL) error processing if((rcvbuf = (char *)tpalloc("carray", NULL, 1024)) == NULL) error processing if(tpcall("login", sndbuf, 1024, &rcvbuf, &rcvlen, 0) == -1) error processing printf("after tpcall() received Message from server:%s\n", rcvbuf); Tmax Programming Guide (UCS)

58 while(1) tpgetunsol(unsol_tpsendtocli, &rcvbuf, &rcvlen, TPBLOCK); printf("loop Count : %d\n", RecvCnt); if(rcvlen > 0) printf("counter : %d #[Received Data from Server : %s]\n ", RecvCnt, rcvbuf); RecvCnt ++; if (RecvCnt == 10) break; tpfree((char *)sndbuf); tpfree((char *)rcvbuf); tpend(); tmaxs2:/user/jaya/tmax3511/sample/client> ucs_client After tpcall() received Message from server:client Registration Success Loop Count : 0 Counter : 0 #[Received Data from Server : Success tpsendtocli [0]] Loop Count : 1 Counter : 1 #[Received Data from Server : Success tpsendtocli [1]] Loop Count : 2 Counter : 2 #[Received Data from Server : Success tpsendtocli [2]] Loop Count : 3 Counter : 3 #[Received Data from Server : Success tpsendtocli [3]] Loop Count : 4 Counter : 4 #[Received Data from Server : Success tpsendtocli [4]] Server Program Server Program Tmax 5 sleep loop execute 0 loop sleep(5); printf ("loop execute %d\n", count); loop while loop jobs = tpschedule(-1);, loop, client_id[num_cli] = tpgetclid(); printf("client id(clid) = %d\n", client_id[num_cli]); num_cli++; Tmax Programming Guide (UCS)

59 id while loopfor loop count sndbuf tpsendtocli() for (i = 0; i < num_cli; i++) sprintf(sndbuf, "Success tpsendtocli [%d]", count++); /* Client id */ tpsendtocli (client_id[i], sndbuf, 1024, 0); sndbuf tpreturn() sprintf(sndbuf, "Client Registration Success"); tpreturn(tpsuccess, 0, (char *)sndbuf, 1000, 0); #include <stdioh> #include <usrinc/atmih> #include <usrinc/ucsh> #define MAX_CLI 100 int num_cli; int client_id[max_cli]; int count; tpsvrinit(int argc, char *argv[]) num_cli = 0; count = 0; printf("ucs Type Server tpsvrinit() is call\n"); /* tmaxucs main */ int usermain(int argc, char *argv[]) int jobs; int i; int ret; char *sndbuf; static int count = 0; printf("usermain start\n"); sndbuf = (char *)tpalloc("carray", NULL, 1024); while(1) sleep(5); printf ("loop execute %d\n", count); for (i = 0; i < num_cli; i++) sprintf(sndbuf, "Success tpsendtocli [%d]", count++); Tmax Programming Guide (UCS)

60 /* Client id */ tpsendtocli (client_id[i], sndbuf, 1024, 0); jobs = tpschedule(-1); /* while */ LOGIN(TPSVCINFO *msg) char *sndbuf; int clid; int ret; int i; sndbuf = (char *)tpalloc("carray", NULL, 1024); if (num_cli < MAX_CLI) /* Clientid */ client_id[num_cli] = tpgetclid(); printf("client id(clid) = %d\n", client_id[num_cli]); num_cli++; sprintf(sndbuf, "Client Registration Success"); tpreturn(tpsuccess, 0, (char *)sndbuf, 1000, 0); tpsvrdone() usermain start UCS Type Server tpsvrinit() is call usermain start loop execute 0 loop execute 0 loop execute 0 client id(clid) = loop execute 0 loop execute 1 loop execute 2 loop execute 3 loop execute 4 loop execute 5 loop execute 6 loop execute 7 loop execute 8 loop execute 9 loop execute 10 Tmax Programming Guide (UCS)

61 loop execute 11 loop execute 12 loop execute 13 loop execute 14 client id(clid) = loop execute 15 loop execute 17 loop execute 19 Tmax Programming Guide (UCS)

62 522 UCS 3 UCS Loop, select call insert ucssvrcucs mainsvrpc MAIN tpcall UCS tpcall mainsvrpc test_sel select inssvrpc INS tpcall tpcall inssvrpctest_ins test_sel select insert mainsvrpctx_commit() test_sel inssvrpc delete test_sel 6 6 delete 1403 Config File *DOMAIN tmax1 SHMKEY =79970, MINCLH=1, MAXCLH=3, TPORTNO=8844, BLOCKTIME=120 *NODE tmaxs2 TMAXDIR = "/user/jaya/tmax3511", APPDIR = "/user/jaya/tmax3511/appbin", PATHDIR = "/user/jaya/tmax3511/path", TLOGDIR = "/user/jaya/tmax3511/log/tlog", ULOGDIR = "/user/jaya/tmax3511/log/ulog", SLOGDIR = "/user/jaya/tmax3511/log/slog" *SVRGROUP tmaxs2_nx NODENAME = "tmaxs2" ### tms for Oracle ### Tmax Programming Guide (UCS)

63 tmaxs2_xa *SERVER ucssvr mainsvr inssvr NODENAME = "tmaxs2", DBNAME = ORACLE, OPENINFO = "Oracle_XA+Acc=P/scott/tiger+SesTm=60", TMSNAME = tms_ora SVGNAME = tmaxs2_nx, SVRTYPE = UCS, MIN = 1 SVGNAME = tmaxs2_xa, MIN = 1 SVGNAME = tmaxs2_xa, MIN = 1 *SERVICE MAIN INS DB Table SQL> select * from test_sel; A aaaaa bbbbb ccccc ddddd eeeee fffff SVRNAME = mainsvr SVRNAME = ins 6 rows selected SQL> select * from test_ins; no rows selected Server Program (ucssvrc ) #include <stdioh> #include <usrinc/atmih> #include <unistdh> int usermain(int argc, char *argv[]) /* tmaxucs main */ int ret; Tmax Programming Guide (UCS)

64 int long char jobs; len; *sndbuf, *rcvbuf; printf("usermain start\n"); sndbuf = (char *)tpalloc("string", NULL, 0); rcvbuf = (char *)tpalloc("string", NULL, 0); while(1) ret = tpcall("main", sndbuf, 0, &rcvbuf, &len, 0); if (ret == -1) error processing jobs = tpschedule(-1); sleep (10); Server Program (mainsvrpc ) #include <stdioh> #include <ctypeh> #include <usrinc/atmih> EXEC SQL include sqlcah; #define MAXROW 6 EXEC SQL begin declare section; varchar v_a[maxrow][11]; EXEC SQL end declare section; MAIN(TPSVCINFO *msg) char *sndbuf, *rcvbuf; int i=0, errno; long len, ret; printf("[mainsvr] START\n"); printf("[mainsvr] CURSOR DECLARE\n"); EXEC SQL DECLARE cur_test_sel CURSOR FOR SELECT NVL(a,' ') FROM test_sel WHERE rownum <= 6; Tmax Programming Guide (UCS)

65 printf("[mainsvr] CURSOR OPEN\n"); EXEC SQL OPEN cur_test_sel; printf("[mainsvr] open cursor error : %d\n", sqlcasqlcode); if ( sqlcasqlcode!= 0 ) error processing printf("[mainsvr] CURSOR FETCH\n"); EXEC SQL FETCH cur_test_sel into :v_a; if (sqlcasqlcode < 0) errno = sqlcasqlcode; printf("[mainsvr] Fetch error : %d", errno); printf("[mainsvr] CURSOR CLOSE\n"); EXEC SQL CLOSE cur_test_sel; printf("[mainsvr] TPRETURN FAIL\n"); tpreturn( TPFAIL, errno, (char *)NULL, 0, 0 ); printf("[mainsvr] CURSOR CLOSE\n"); EXEC SQL CLOSE cur_test_sel; for(i=0; i<maxrow; i++) sndbuf = (char *)tpalloc("string", 0, 0); rcvbuf = (char *)tpalloc("string", 0, 0); v_a[i]arr[v_a[i]len] = 0; strcpy(sndbuf, v_a[i]arr); printf("[mainsvr] %d : %s / %s\n", i, v_a[i]arr, sndbuf); printf("[mainsvr] TX_BEGIN\n"); ret = tx_begin(); if (ret < 0) error processing printf("[mainsvr] INSERT\n"); if(tpcall("ins", sndbuf, strlen(sndbuf), &rcvbuf, &len, 0)<0) error processing else /* Success */ printf("[mainsvr] TX_COMMIT\n"); EXEC SQL DELETE FROM TEST_SEL WHERE A = :sndbuf; if(sqlcasqlcode!= 0) printf("[mainsvr] delete error : %d\n", sqlcasqlcode); Tmax Programming Guide (UCS)

66 ret = tx_rollback(); if (ret < 0) error processing error processing tpfree(sndbuf); tpfree(rcvbuf); ret = tx_commit(); if (ret < 0) error processing tpreturn( TPSUCCESS, 0, (char *)NULL, 0, 0 ); Server Program (inssvrpc ) #include <stdioh> #include <ctypeh> #include <usrinc/atmih> EXEC SQL include sqlcah; INS( TPSVCINFO *msg ) char *buf; int i=0, errno; long len; printf("woong : START\n"); buf = (char *)msg->data; printf("%s\n", buf); printf("woong : INSERT\n"); EXEC SQL INSERT INTO TEST_INS VALUES(:buf); if (sqlcasqlcode!= 0 ) error processing Tmax Programming Guide (UCS)

67 fflush(stdout); tpreturn(tpsuccess, 0, (char *)NULL, 0, 0 ); [mainsvr] START [mainsvr] CURSOR DECLARE [mainsvr] CURSOR OPEN [mainsvr] open cursor error : 0 [mainsvr] CURSOR FETCH [mainsvr] CURSOR CLOSE [mainsvr] 0 : aaaaa / aaaaa [mainsvr] TX_BEGIN [mainsvr] INSERT woong : START aaaaa woong : INSERT woong : TPRETURN SUCCESS [mainsvr] TX_COMMIT [mainsvr] 1 : bbbbb / bbbbb [mainsvr] TX_BEGIN [mainsvr] INSERT woong : START bbbbb woong : INSERT woong : TPRETURN SUCCESS [mainsvr] TX_COMMIT [mainsvr] 2 : ccccc / ccccc [mainsvr] TX_BEGIN [mainsvr] INSERT woong : START ccccc woong : INSERT woong : TPRETURN SUCCESS [mainsvr] TX_COMMIT [mainsvr] 3 : ddddd / ddddd [mainsvr] TX_BEGIN [mainsvr] INSERT woong : START ddddd Tmax Programming Guide (UCS)

68 woong : INSERT woong : TPRETURN SUCCESS [mainsvr] TX_COMMIT [mainsvr] 4 : eeeee / eeeee [mainsvr] TX_BEGIN [mainsvr] INSERT woong : START eeeee woong : INSERT woong : TPRETURN SUCCESS [mainsvr] TX_COMMIT [mainsvr] 5 : fffff / fffff [mainsvr] TX_BEGIN [mainsvr] INSERT woong : START fffff woong : INSERT woong : TPRETURN SUCCESS [mainsvr] TX_COMMIT 6 select [mainsvr] TPRETURN SUCCESS [mainsvr] START [mainsvr] CURSOR DECLARE [mainsvr] CURSOR OPEN [mainsvr] open cursor error : 0 [mainsvr] CURSOR FETCH [mainsvr] CURSOR CLOSE [mainsvr] 0 : aaaaa / aaaaa [mainsvr] TX_BEGIN [mainsvr] INSERT woong : START aaaaa woong : INSERT woong : TPRETURN SUCCESS [mainsvr] TX_COMMIT [mainsvr] delete error : 1403 [mainsvr] TPRETURN FAIL [mainsvr] START [mainsvr] CURSOR DECLARE [mainsvr] CURSOR OPEN [mainsvr] open cursor error : 0 [mainsvr] CURSOR FETCH [mainsvr] CURSOR CLOSE [mainsvr] 0 : aaaaa / aaaaa [mainsvr] TX_BEGIN [mainsvr] INSERT woong : START aaaaa Tmax Programming Guide (UCS)

69 woong : INSERT woong : TPRETURN SUCCESS [mainsvr] TX_COMMIT [mainsvr] delete error : 1403 [mainsvr] TPRETURN FAIL tableselect, SQL> select * from test_ins; NAME bbbbb ccccc ddddd eeeee fffff aaaaa 6 rows selected SQL> select * from test_sel; no rows selected Tmax Programming Guide (UCS)

70 53 RDP 531 RDP RDP REAL shared memory RDP shared memory UNREAL Config File *DOMAIN tmax1 SHMKEY=73060, MINCLH=2, MAXCLH=2, TPORTNO=8800 *NODE tmaxs1 *SVRGROUP svg1 *SERVER realsvr realtest *SERVICE REAL UNREAL TMAXDIR ="/home/tmax ", APPDIR = "/home/tmax/appbin", PATHDIR = "/home/tmax/path", TLOGDIR = "/home/tmax/log/tlog", ULOGDIR = "/home/tmax/log/ulog", SLOGDIR = "/home/tmax/log/slog", REALSVR="realtest", RSCPC = 16 NODENAME = "tmaxs1" SVGNAME = svg1 SVGNAME = svg1, MIN = 2, MAX = 2, SVRTYPE = REALSVR, MAXRSTART = 0 # UCS TCS TypeService SVRNAME = ucssvr SVRNAME = ucssvr Client Program Tmax Programming Guide (UCS)

71 #include <stdioh> #include <usrinc/atmih> #include <usrinc/ucsh> main(int argc, char *argv[]) char *sndbuf; char *rcvbuf; long rcvlen; int RecvCnt = 0, ret; if(tpstart((tpstart_t *)NULL) == -1) error processing tpsetunsol_flag(tpunsol_poll); if((sndbuf = (char *)tpalloc("carray", NULL, 1024)) == NULL) error processing if((rcvbuf = (char *)tpalloc("carray", NULL, 1024)) == NULL) error processing if(tpcall("real", sndbuf, 1024, &rcvbuf, &rcvlen, 0) == -1) error processing while(1) ret = tpgetunsol(unsol_tpsendtocli, &rcvbuf, &rcvlen, TPBLOCK); printf("loop Count : %d\n", RecvCnt); if(ret > 0) printf("ret message[%s]\n, rcvbuf); RecvCnt ++; if (RecvCnt == 10) break; if(tpcall("unreal", sndbuf, 1024, &rcvbuf, &rcvlen, 0) == -1) error processing RecvCnt = 0; while(1) ret = tpgetunsol(unsol_tpsendtocli, &rcvbuf, &rcvlen, TPBLOCK); printf("loop Count : %d\n", RecvCnt); if(ret > 0) printf("ret message[%s]\n, rcvbuf); Tmax Programming Guide (UCS)

72 RecvCnt ++; if (RecvCnt == 10) break; tpfree((char *)sndbuf); tpfree((char *)rcvbuf); tpend(); Server Program ( realsvrc ) #include #include #include #include #include #include #include <stdioh> <sys/typesh> <sys/ipch> <sys/shmh> <sys/timeh> <usrinc/tmaxapih> <usrinc/ucsh> int shm_creator = 0; int *shm; int id; #define TABLE_SIZE (FD_SETSIZE * 10) tpsvrinit(int argc, char *argv[]) int i; id = shmget(0x12345, TABLE_SIZE * sizeof(int), IPC_CREAT IPC_EXCL SHM_R SHM_W); if (id < 0) id = shmget(0x12345, TABLE_SIZE * sizeof(int), 0); if (id < 0) error processing else shm_creator = 1; shm = (int *)shmat(id, 0, 0); if (shm == (void*)-1) error processing if (shm_creator) for (i = 0; i < TABLE_SIZE; i++) shm[i] = -1; printf("svr20 started\n"); return 1; Tmax Programming Guide (UCS)

73 tpsvrdone() shmdt((char *)shm); if (shm_creator) shmctl(id, IPC_RMID, (struct shmid_ds *) 0); printf("svr20 closed\n"); REAL(TPSVCINFO *rqst) int i, clid; clid = tpgetclid(); for (i = 0; i < TABLE_SIZE; i++) if (shm[i] == clid) shm[i] = -1; for (i = 0; i < TABLE_SIZE; i++) if (shm[i] == -1) shm[i] = clid; break; tpreturn(tpsuccess, 0, rqst->data, rqst->len, 0); UNREAL(TPSVCINFO *rqst) int i, clid; clid = tpgetclid(); for (i = 0; i < TABLE_SIZE; i++) if (shm[i] == clid) shm[i] = -1; usleep(10000); tpreturn(tpsuccess, 0, rqst->data, rqst->len, 0); Server Program ( realtestc ) #include <stdioh> #include <sys/typesh> #include <sys/ipch> #include <sys/shmh> #include <sys/timeh> #include <sys/timebh> #include <usrinc/tmaxapih> #include <usrinc/ucsh> Tmax Programming Guide (UCS)

74 int shm_creator = 0; int *shm; int id; #define TABLE_SIZE (FD_SETSIZE * 10) #define MSG_LEN ( ) #define SEND_INTERVAL (100000) long time_diff(struct timeval *a, struct timeval *b) long sec, usec; sec = a->tv_sec - b->tv_sec; usec = a->tv_usec - b->tv_usec; return (sec * usec); tpsvrinit(int argc, char *argv[]) int i; id = shmget(0x12345, TABLE_SIZE * sizeof(int), IPC_CREAT IPC_EXCL SHM_R SHM_W); if (id < 0) id = shmget(0x12345, TABLE_SIZE * sizeof(int), 0); if (id < 0) error processing else shm_creator = 1; shm = (int *)shmat(id, 0, 0); if (shm == (void*)-1) error processing if (shm_creator) for (i = 0; i < TABLE_SIZE; i++) shm[i] = -1; printf("realsvr started\n"); return 1; tpsvrdone() shmdt((char *)shm); if (shm_creator) shmctl(id, IPC_RMID, (struct shmid_ds *) 0); printf("realsvr closed\n"); Tmax Programming Guide (UCS)

75 usermain(int argc, char *argv[]) char *sndbuf; long sndlen; int i, n, msgid, previd, clid; int fail, delay, loop; long diff; struct timeval cur, prev, prev_stat; int max, mine; max = tpgetminsvr(); mine = tpgetsvrseqno(); if ((sndbuf = (char *)tpalloc("carray",null, 2048)) == NULL) error processing msgid = previd = fail = delay = 0; gettimeofday(&prev, NULL); prev_stat = prev; while(1) gettimeofday(&cur, NULL); if (mine == (max - 1)) diff = time_diff(&cur, &prev_stat); if (diff >= ) printf("realsvr: Sent = %d, fail = %d, delay = %d, " "int = %d:%06d\n", msgid - previd, fail, delay, diff / , diff % ); previd = msgid; delay = fail = 0; prev_stat = cur; diff = time_diff(&cur, &prev); if (diff < SEND_INTERVAL) tpuschedule(send_interval - diff); else delay++; if (diff >= (SEND_INTERVAL * 2)) printf("long Schedule delay %d\n", diff); gettimeofday(&prev, NULL); for (i = 0; i < TABLE_SIZE; i++) clid = shm[i]; if (tpchkclid(clid) < 0) continue; sprintf(sndbuf, "Msg(%d) sent to clid = %#x", msgid++, clid); n = tpsendtocli(clid, sndbuf, MSG_LEN, TPFLOWCONTROL); Tmax Programming Guide (UCS)

Microsoft Word - Tmax Programming Guide _ UCS _.doc

Microsoft Word - Tmax Programming Guide _ UCS _.doc Tmax Programming Guide ( UCS ) Copyright 2000 TmaxSoft Co., Ltd. All Rights Reserved Copyright Notice Copyright 2000 TmaxSoft Co., Ltd. All Rights Reserved. TmaxSoft Co., Ltd. 대한민국서울시강남구대치동 946-1 글라스타워

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 Network Programming Jo, Heeseung Network 실습 네트워크프로그래밍 멀리떨어져있는호스트들이서로데이터를주고받을수있도록프로그램을구현하는것 파일과는달리데이터를주고받을대상이멀리떨어져있기때문에소프트웨어차원에서호스트들간에연결을해주는장치가필요 이러한기능을해주는장치로소켓이라는인터페이스를많이사용 소켓프로그래밍이란용어와네트워크프로그래밍이랑용어가같은의미로사용

More information

목차 1. 환경변수 OS별환경변수설정 ESQL 시작 ESQL 프로그램생성젃차 오라클 Pro*C 젂환 Precompiler 변경 확장자 *.pc를 *.tbc로변경

목차 1. 환경변수 OS별환경변수설정 ESQL 시작 ESQL 프로그램생성젃차 오라클 Pro*C 젂환 Precompiler 변경 확장자 *.pc를 *.tbc로변경 개발및운영 Tibero ProC 전환및 Tmax 설정 2014. 05. 16. 목차 1. 환경변수... 3 1.1. OS별환경변수설정... 3 2. ESQL 시작... 4 2.1. ESQL 프로그램생성젃차... 4 3. 오라클 Pro*C 젂환... 5 3.1 Precompiler 변경... 5 3.2 확장자 *.pc를 *.tbc로변경... 5 3.3 티베로젂환시주의사항...

More information

13주-14주proc.PDF

13주-14주proc.PDF 12 : Pro*C/C++ 1 2 Embeded SQL 3 PRO *C 31 C/C++ PRO *C NOT! NOT AND && AND OR OR EQUAL == = SQL,,, Embeded SQL SQL 32 Pro*C C SQL Pro*C C, C Pro*C, C C 321, C char : char[n] : n int, short, long : float

More information

6주차.key

6주차.key 6, Process concept A program in execution Program code PCB (process control block) Program counter, registers, etc. Stack Heap Data section => global variable Process in memory Process state New Running

More information

Tmax COBOL Guide : TMCG : Tmax 3.8 : July 31, 2003 : Sep 20, 2003

Tmax COBOL Guide : TMCG : Tmax 3.8 : July 31, 2003 : Sep 20, 2003 Tmax COBOL Guide : TMCG-0731-03-380 : Tmax 3.8 : July 31, 2003 : Sep 20, 2003 Tmax COBOL Guide Tmax 3.8 Tmax COBOL Guide Tmax COBOL Guide Tmax COBOL Guide 1. 1.1... 7 1.2 Sample file... 8 1.2.1 Sample

More information

À©µµ³×Æ®¿÷ÇÁ·Î±×·¡¹Ö4Àå_ÃÖÁ¾

À©µµ³×Æ®¿÷ÇÁ·Î±×·¡¹Ö4Àå_ÃÖÁ¾ P a 02 r t Chapter 4 TCP Chapter 5 Chapter 6 UDP Chapter 7 Chapter 8 GUI C h a p t e r 04 TCP 1 3 1 2 3 TCP TCP TCP [ 4 2] listen connect send accept recv send recv [ 4 1] PC Internet Explorer HTTP HTTP

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 KeyPad Device Control - Device driver Jo, Heeseung HBE-SM5-S4210 에는 16 개의 Tack Switch 를사용하여 4 행 4 열의 Keypad 가장착 4x4 Keypad 2 KeyPad 를제어하기위하여 FPGA 내부에 KeyPad controller 가구현 KeyPad controller 16bit 로구성된

More information

untitled

untitled Step Motor Device Driver Embedded System Lab. II Step Motor Step Motor Step Motor source Embedded System Lab. II 2 open loop, : : Pulse, 1 Pulse,, -, 1 +5%, step Step Motor (2),, Embedded System Lab. II

More information

vi 사용법

vi 사용법 네트워크프로그래밍 6 장과제샘플코드 - 1:1 채팅 (udp 버전 ) 과제 서버에서먼저 bind 하고그포트를다른사람에게알려줄것 클라이언트에서알려준포트로접속 서로간에키보드입력을받아상대방에게메시지전송 2 Makefile 1 SRC_DIR =../../common 2 COM_OBJS = $(SRC_DIR)/addressUtility.o $(SRC_DIR)/dieWithMessage.o

More information

슬라이드 1

슬라이드 1 / 유닉스시스템개요 / 파일 / 프로세스 01 File Descriptor file file descriptor file type unix 에서의파일은단지바이트들의나열임 operating system 은파일에어떤포맷도부과하지않음 파일의내용은바이트단위로주소를줄수있음 file descriptor 는 0 이나양수임 file 은 open 이나 creat 로 file

More information

K&R2 Reference Manual 번역본

K&R2 Reference Manual 번역본 typewriter structunion struct union if-else if if else if if else if if if if else else ; auto register static extern typedef void char short int long float double signed unsigned const volatile { } struct

More information

JEUS WebT Copyright 2004 Tmax Soft Co., Ltd. All Rights Reserved.

JEUS WebT Copyright 2004 Tmax Soft Co., Ltd. All Rights Reserved. JEUS WebT Copyright 2004 Tmax Soft Co, Ltd All Rights Reserved Copyright Notice Copyright 2004 Tmax Soft Co, Ltd All Rights Reserved Tmax Soft Co, Ltd 946-1 18 )135-708 Restricted Rights Legend This software

More information

chap7.key

chap7.key 1 7 C 2 7.1 C (System Calls) Unix UNIX man Section 2 C. C (Library Functions) C 1975 Dennis Ritchie ANSI C Standard Library 3 (system call). 4 C?... 5 C (text file), C. (binary file). 6 C 1. : fopen( )

More information

Tmax FDL Reference Manual : TMFR : Tmax 3.8 : Sep 20, 2003 : Sep 20, 2003

Tmax FDL Reference Manual : TMFR : Tmax 3.8 : Sep 20, 2003 : Sep 20, 2003 Tmax FDL Reference Manual : TMFR-0702-08-380 : Tmax 3.8 : Sep 20, 2003 : Sep 20, 2003 Tmax FDL Reference Manual Tmax 3.8 1 2 Copyright (c) 2001 Tmax Soft Co., Ltd. All Rights Reserved.,,, Tmax soft.,,,.....

More information

SYN flooding

SYN flooding Hacking & Security Frontier SecurityFirst SYN flooding - SYN flooding 공격의원리와코드그리고대응 by amur, myusgun, leemeca 2008. 09. myusgun Agenda 개요...3 원리...3 위협...4 잠깐! - 문서에관하여...4 이문서는...4 Code...4 대응방안...4 소스코드...5

More information

제1장 Unix란 무엇인가?

제1장  Unix란 무엇인가? 1 13 장소켓 2 13.1 소켓 클라이언트 - 서버모델 네트워크응용프로그램 클리이언트 - 서버모델을기반으로동작한다. 클라이언트 - 서버모델 하나의서버프로세스와여러개의클라이언트로구성된다. 서버는어떤자원을관리하고클라이언트를위해자원관련서비스를제공한다. 3 소켓의종류 소켓 네트워크에대한사용자수준의인터페이스를제공 소켓은양방향통신방법으로클라이언트 - 서버모델을기반으로프로세스사이의통신에매우적합하다.

More information

제1장 Unix란 무엇인가?

제1장  Unix란 무엇인가? 1 소켓 2 1 소켓 클라이언트 - 서버모델 네트워크응용프로그램 클리이언트 - 서버모델을기반으로동작한다. 클라이언트 - 서버모델 하나의서버프로세스와여러개의클라이언트로구성된다. 서버는어떤자원을관리하고클라이언트를위해자원관련서비스를제공한다. 3 소켓의종류 소켓 네트워크에대한사용자수준의인터페이스를제공 소켓은양방향통신방법으로클라이언트 - 서버모델을기반으로프로세스사이의통신에매우적합하다.

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 7-Segment Device Control - Device driver Jo, Heeseung HBE-SM5-S4210 의 M3 Module 에는 6 자리를가지는 7-Segment 모듈이아래그림처럼실장 6 Digit 7-Segment 2 6-Digit 7-Segment LED controller 16비트로구성된 2개의레지스터에의해제어 SEG_Sel_Reg(Segment

More information

2009년 상반기 사업계획

2009년 상반기 사업계획 소켓프로그래밍활용 IT CookBook, 유닉스시스템프로그래밍 학습목표 소켓인터페이스를활용한다양한프로그램을작성할수있다. 2/23 목차 TCP 기반프로그래밍 반복서버 동시동작서버 동시동작서버-exec함수사용하기 동시동작서버-명령행인자로소켓기술자전달하기 UDP 프로그래밍 3/23 TCP 기반프로그래밍 반복서버 데몬프로세스가직접모든클라이언트의요청을차례로처리 동시동작서버

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 7-Segment Device Control - Device driver Jo, Heeseung HBE-SM5-S4210 의 M3 Module 에는 6 자리를가지는 7-Segment 모듈이아래그림처럼실장 6 Digit 7-Segment 2 6-Digit 7-Segment LED Controller 16비트로구성된 2개의레지스터에의해제어 SEG_Sel_Reg(Segment

More information

61 62 63 64 234 235 p r i n t f ( % 5 d :, i+1); g e t s ( s t u d e n t _ n a m e [ i ] ) ; if (student_name[i][0] == \ 0 ) i = MAX; p r i n t f (\ n :\ n ); 6 1 for (i = 0; student_name[i][0]!= \ 0&&

More information

Microsoft PowerPoint - 09-Pipe

Microsoft PowerPoint - 09-Pipe 9. 파이프 상명대학교소프트웨어학부 파이프 시그널은이상한사건이나오류를처리하는데는이용하지만, 한프로세스로부터다른프로세스로대량의정보를전송하는데는부적합하다. 파이프 한프로세스를다른관련된프로세스에연결시켜주는단방향의통신채널 2 pipe() Usage #include int pipe(int filedes[2]); 3 < ex_1.c > #include

More information

Microsoft PowerPoint - lab14.pptx

Microsoft PowerPoint - lab14.pptx Mobile & Embedded System Lab. Dept. of Computer Engineering Kyung Hee Univ. Keypad Device Control in Embedded Linux HBE-SM5-S4210 에는 16 개의 Tack Switch 를사용하여 4 행 4 열의 Keypad 가장착되어있다. 2 Keypad Device Driver

More information

Tmax Getting Started Guide Tmax 3.8 Tmax Getting Started Guide

Tmax Getting Started Guide Tmax 3.8 Tmax Getting Started Guide Tmax Getting Started Guide : TMGS-0731-05-380 : Tmax 3.8 : July 31, 2003 : Sep 20, 2003 Tmax Getting Started Guide Tmax 3.8 Tmax Getting Started Guide Copyright (c) 2001 Tmax Soft Co., Ltd. All Rights

More information

<C0CCBCBCBFB52DC1A4B4EBBFF82DBCAEBBE7B3EDB9AE2D313939392D382E687770>

<C0CCBCBCBFB52DC1A4B4EBBFF82DBCAEBBE7B3EDB9AE2D313939392D382E687770> i ii iii iv v vi 1 2 3 4 가상대학 시스템의 국내외 현황 조사 가상대학 플랫폼 개발 이상적인 가상대학시스템의 미래상 제안 5 웹-기반 가상대학 시스템 전통적인 교수 방법 시간/공간 제약을 극복한 학습동기 부여 교수의 일방적인 내용전달 교수와 학생간의 상호작용 동료 학생들 간의 상호작용 가상대학 운영 공지사항,강의록 자료실, 메모 질의응답,

More information

본 강의에 들어가기 전

본 강의에 들어가기 전 C 기초특강 종합과제 과제내용 구조체를이용하여교과목이름과코드를파일로부터입력받아관리 구조체를이용하여학생들의이름, 학번과이수한교과목의코드와점수를파일로부터입력 학생개인별총점, 평균계산 교과목별이수학생수, 총점및평균을계산 결과를파일에저장하는프로그램을작성 2 Makefile OBJS = score_main.o score_input.o score_calc.o score_print.o

More information

<43B7CE20BECBBEC6BAB8B4C220BCD2C4CFC7C1B7CEB1D7B7A1B9D62E687770>

<43B7CE20BECBBEC6BAB8B4C220BCD2C4CFC7C1B7CEB1D7B7A1B9D62E687770> C 로알아보는 소켓프로그래밍 이현환 (NOON) haonun@gmail.com http://noon.tistory.com Hacking Study Grup E.Y.E -------------------------------------------------------------------- 목차 --------------------------------------------------------------------

More information

Sena Technologies, Inc. HelloDevice Super 1.1.0

Sena Technologies, Inc. HelloDevice Super 1.1.0 HelloDevice Super 110 Copyright 1998-2005, All rights reserved HelloDevice 210 ()137-130 Tel: (02) 573-5422 Fax: (02) 573-7710 E-Mail: support@senacom Website: http://wwwsenacom Revision history Revision

More information

[ 목차 ] 1. 취약점개요 2. 배경지식 3. 취약점발생결과 (exploit 테스트 ) 4. 취약점발생원인분석 4.1 취약점 Q&A 5. exploit 분석 6. 보안대책 7. 결론 8. 레퍼런스 2

[ 목차 ] 1. 취약점개요 2. 배경지식 3. 취약점발생결과 (exploit 테스트 ) 4. 취약점발생원인분석 4.1 취약점 Q&A 5. exploit 분석 6. 보안대책 7. 결론 8. 레퍼런스 2 CVE-2016-3857 취약점분석보고서 ( 안드로이드커널임의쓰기취약점 ) ㅁ작성자 : x90c (x90chacker@gmail.com) ㅁ작성일 : 2018 년 7 월 18 일 ( 수 ) ㅁ대외비등급 : A (Top Secret) 1 [ 목차 ] 1. 취약점개요 2. 배경지식 3. 취약점발생결과 (exploit 테스트 ) 4. 취약점발생원인분석 4.1 취약점

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 Web server porting 2 Jo, Heeseung Web 을이용한 LED 제어 Web 을이용한 LED 제어프로그램 web 에서데이터를전송받아타겟보드의 LED 를조작하는프로그램을작성하기위해다음과같은소스파일을생성 2 Web 을이용한 LED 제어 LED 제어프로그램작성 8bitled.html 파일을작성 root@ubuntu:/working/web# vi

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 7-SEGMENT DEVICE CONTROL - DEVICE DRIVER Jo, Heeseung 디바이스드라이버구현 : 7-SEGMENT HBE-SM5-S4210 의 M3 Module 에는 6 자리를가지는 7-Segment 모듈이아래그림처럼실장 6 Digit 7-Segment 2 디바이스드라이버구현 : 7-SEGMENT 6-Digit 7-Segment LED

More information

강의10

강의10 Computer Programming gdb and awk 12 th Lecture 김현철컴퓨터공학부서울대학교 순서 C Compiler and Linker 보충 Static vs Shared Libraries ( 계속 ) gdb awk Q&A Shared vs Static Libraries ( 계속 ) Advantage of Using Libraries Reduced

More information

The Pocket Guide to TCP/IP Sockets: C Version

The Pocket Guide to  TCP/IP Sockets: C Version 1 목포해양대해양컴퓨터공학과 UDP 소켓 네트워크프로그램설계 4 장 2 목포해양대해양컴퓨터공학과 목차 제 4장 UDP 소켓 4.1 UDP 클라이언트 4.2 UDP 서버 4.3 UDP 소켓을이용한데이터송신및수신 4.4 UDP 소켓의연결 3 목포해양대해양컴퓨터공학과 UDP 소켓의특징 UDP 소켓의특성 신뢰할수없는데이터전송방식 목적지에정확하게전송된다는보장이없음.

More information

Microsoft Word - Network Programming_NewVersion_01_.docx

Microsoft Word - Network Programming_NewVersion_01_.docx 10. Unix Domain Socket 105/113 10. Unix Domain Socket 본절에서는 Unix Domain Socket(UDS) 에대한개념과이에대한실습을수행하고, 이와동시에비신뢰적인통신시스템의문제점에대해서분석하도록한다. 이번실습의목표는다음과같다. 1. Unix Domain Socket의사용법을익히고, IPC에대해서실습 2. TCP/IP의응용계층과전달계층의동작을구현및실습

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 (Host) set up : Linux Backend RS-232, Ethernet, parallel(jtag) Host terminal Target terminal : monitor (Minicom) JTAG Cross compiler Boot loader Pentium Redhat 9.0 Serial port Serial cross cable Ethernet

More information

10.

10. 10. 10.1 10.2 Library Routine: void perror (char* str) perror( ) str Error 0 10.3 10.3 int fd; /* */ fd = open (filename, ) /*, */ if (fd = = -1) { /* */ } fcnt1 (fd, ); /* */ read (fd, ); /* */ write

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 Text-LCD Device Control - Device driver Jo, Heeseung M3 모듈에장착되어있는 Tedxt LCD 장치를제어하는 App 을개발 TextLCD 는영문자와숫자일본어, 특수문자를표현하는데사용되는디바이스 HBE-SM5-S4210 의 TextLCD 는 16 문자 *2 라인을 Display 할수있으며, 이 TextLCD 를제어하기위하여

More information

목차 BUG offline replicator 에서유효하지않은로그를읽을경우비정상종료할수있다... 3 BUG 각 partition 이서로다른 tablespace 를가지고, column type 이 CLOB 이며, 해당 table 을 truncate

목차 BUG offline replicator 에서유효하지않은로그를읽을경우비정상종료할수있다... 3 BUG 각 partition 이서로다른 tablespace 를가지고, column type 이 CLOB 이며, 해당 table 을 truncate ALTIBASE HDB 6.1.1.5.6 Patch Notes 목차 BUG-39240 offline replicator 에서유효하지않은로그를읽을경우비정상종료할수있다... 3 BUG-41443 각 partition 이서로다른 tablespace 를가지고, column type 이 CLOB 이며, 해당 table 을 truncate 한뒤, hash partition

More information

제1장 Unix란 무엇인가?

제1장  Unix란 무엇인가? 1 12 장파이프 2 12.1 파이프 파이프원리 $ who sort 파이프 3 물을보내는수도파이프와비슷 한프로세스는쓰기용파일디스크립터를이용하여파이프에데이터를보내고 ( 쓰고 ) 다른프로세스는읽기용파일디스크립터를이용하여그파이프에서데이터를받는다 ( 읽는다 ). 한방향 (one way) 통신 파이프생성 파이프는두개의파일디스크립터를갖는다. 하나는쓰기용이고다른하나는읽기용이다.

More information

1장. 유닉스 시스템 프로그래밍 개요

1장.  유닉스 시스템 프로그래밍 개요 9 장. 파이프 Unix 프로그래밍및실습 1 강의내용 1 절개요 2 절이름없는파이프 3 절이름있는파이프 http://lily.mmu.ac.kr/lecture/13u2/ch09.pdf 책에나온내용반드시 man 으로확인할것! UNIX, LINUX 등시스템마다차이가있을수있음을반드시인식 2 기본실습 #1 [ 예제 9-1] ~ [ 예제 9-7] ( 각 10점 ) 과제개요

More information

Microsoft Word - KPMC-400,401 SW 사용 설명서

Microsoft Word - KPMC-400,401 SW 사용 설명서 LKP Ethernet Card SW 사용설명서 Version Information Tornado 2.0, 2.2 알 림 여기에실린내용은제품의성능향상과신뢰도의증대를위하여예고없이변경될수도있습니다. 여기에실린내용의일부라도엘케이일레븐의사전허락없이어떠한유형의매체에복사되거나저장될수없으며전기적, 기계적, 광학적, 화학적인어떤방법으로도전송될수없습니다. 엘케이일레븐경기도성남시중원구상대원동

More information

Microsoft PowerPoint - 13 ¼ÒÄÏÀ» ÀÌ¿ëÇÑ Åë½Å 2.ppt

Microsoft PowerPoint - 13 ¼ÒÄÏÀ» ÀÌ¿ëÇÑ Åë½Å 2.ppt 13 장소켓을이용한통신 (2) 소켓을이용한통신 (2) 함수 - recvfrom - sendto - uname - gethostname - gethostbyname - gethostbyaddr 1 1. 서론 소켓을사용하여비연결형모델로통신을하기위한함수와그외의함수 함수 의미 recvfrom 비연결형모델에서소켓을통해메시지를수신한다. sendto 비연결형모델에서소켓을통해메시지를송신한다.

More information

3. 다음장에나오는 sigprocmask 함수의설명을참고하여다음프로그램의출력물과그출력물이화면이표시되는시점을예측하세요. ( 힌트 : 각줄이표시되는시점은다음 6 가지중하나. (1) 프로그램수행직후, (2) 5 초후 (3) 10 초후 (4) 15 #include <signa

3. 다음장에나오는 sigprocmask 함수의설명을참고하여다음프로그램의출력물과그출력물이화면이표시되는시점을예측하세요. ( 힌트 : 각줄이표시되는시점은다음 6 가지중하나. (1) 프로그램수행직후, (2) 5 초후 (3) 10 초후 (4) 15 #include <signa 학번 : 이름 : 1. 다음가정하에서아래프로그램의출력물을예측하세요. 가정 : 부모프로세스의 process id=10100, 자식프로세스의 process id=10101. char buf[] = "a write to stdout\n"; int var; /* automatic variable on the stack */ pid_t pid; int glob = 31;

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 Sensor Device Jo, Heeseung Sensor 실습 HBE-SM5-S4210 에는근접 / 가속도 / 컴파스센서가장착 각센서들을사용하기위한디바이스드라이버와어플리케이션을작성 2 근접 (Proximity) 센서 HBE-SM5-S4210 Camera Module 근접센서디바이스 근접센서는사물이다른사물에접촉되기이전에가까이접근하였는지를검출할목적으로사용 일반적으로생활에서자동문이나엘리베이터,

More information

歯9장.PDF

歯9장.PDF 9 Hello!! C printf() scanf() getchar() putchar() gets() puts() fopen() fclose() fprintf() fscant() fgetc() fputs() fgets() gputs() fread() fwrite() fseek() ftell() I/O 2 (stream) C (text stream) : `/n'

More information

1217 WebTrafMon II

1217 WebTrafMon II (1/28) (2/28) (10 Mbps ) Video, Audio. (3/28) 10 ~ 15 ( : telnet, ftp ),, (4/28) UDP/TCP (5/28) centralized environment packet header information analysis network traffic data, capture presentation network

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 Web server porting 2 Jo, Heeseung Web 을이용한 LED 제어 Web 을이용한 LED 제어프로그램 web 에서데이터를전송받아타겟보드의 LED 를조작하는프로그램을작성하기위해다음과같은소스파일을생성 2 Web 을이용한 LED 제어 LED 제어프로그램작성 8bitled.html 파일을작성 root@ubuntu:/working/web# vi

More information

C++-¿Ïº®Çؼ³10Àå

C++-¿Ïº®Çؼ³10Àå C C++. (preprocessor directives), C C++ C/C++... C++, C. C++ C. C C++. C,, C++, C++., C++.,.. #define #elif #else #error #if #itdef #ifndef #include #line #pragma #undef #.,.,. #include #include

More information

교육지원 IT시스템 선진화

교육지원 IT시스템 선진화 Module 16: ioctl 을활용한 LED 제어디바이스드라이버 ESP30076 임베디드시스템프로그래밍 (Embedded System Programming) 조윤석 전산전자공학부 주차별목표 ioctl() 을활용법배우기 커널타이머와 ioctl 을활용하여 LED 제어용디바이스드라이브작성하기 2 IOCTL 을이용한드라이버제어 ioctl() 함수활용 어떤경우에는읽는용도로만쓰고,

More information

untitled

untitled Embedded System Lab. II Embedded System Lab. II 2 RTOS Hard Real-Time vs Soft Real-Time RTOS Real-Time, Real-Time RTOS General purpose system OS H/W RTOS H/W task Hard Real-Time Real-Time System, Hard

More information

/chroot/lib/ /chroot/etc/

/chroot/lib/ /chroot/etc/ 구축 환경 VirtualBox - Fedora 15 (kernel : 2.6.40.4-5.fc15.i686.PAE) 작동 원리 chroot유저 ssh 접속 -> 접속유저의 홈디렉토리 밑.ssh의 rc 파일 실행 -> daemonstart실행 -> daemon 작동 -> 접속 유저만의 Jail 디렉토리 생성 -> 접속 유저의.bashrc 의 chroot 명령어

More information

학번 : 이름 1. 다음프로그램실행결과를예측하시오. $./a.out & [1] 7216 $ kill -USR $ kill -USR 아래학생이작성한쓰레드코드의문제점을설명하시오. void* thread_main() { pthread_mutex_t

학번 : 이름 1. 다음프로그램실행결과를예측하시오. $./a.out & [1] 7216 $ kill -USR $ kill -USR 아래학생이작성한쓰레드코드의문제점을설명하시오. void* thread_main() { pthread_mutex_t 학번 : 이름 1. 다음프로그램실행결과를예측하시오. $./a.out & [1] 7216 $ kill -USR1 7216 $ kill -USR2 7216 2. 아래학생이작성한쓰레드코드의문제점을설명하시오. void* thread_main() pthread_mutex_t lock=pthread_mutex_initializer; pthread_mutex_lock(&lock);

More information

ORANGE FOR ORACLE V4.0 INSTALLATION GUIDE (Online Upgrade) ORANGE CONFIGURATION ADMIN O

ORANGE FOR ORACLE V4.0 INSTALLATION GUIDE (Online Upgrade) ORANGE CONFIGURATION ADMIN O Orange for ORACLE V4.0 Installation Guide ORANGE FOR ORACLE V4.0 INSTALLATION GUIDE...1 1....2 1.1...2 1.2...2 1.2.1...2 1.2.2 (Online Upgrade)...11 1.3 ORANGE CONFIGURATION ADMIN...12 1.3.1 Orange Configuration

More information

(Asynchronous Mode) ( 1, 5~8, 1~2) & (Parity) 1 ; * S erial Port (BIOS INT 14H) - 1 -

(Asynchronous Mode) ( 1, 5~8, 1~2) & (Parity) 1 ; * S erial Port (BIOS INT 14H) - 1 - (Asynchronous Mode) - - - ( 1, 5~8, 1~2) & (Parity) 1 ; * S erial Port (BIOS INT 14H) - 1 - UART (Univ ers al As y nchronous Receiver / T rans mitter) 8250A 8250A { COM1(3F8H). - Line Control Register

More information

Microsoft PowerPoint - Lecture_Note_5.ppt [Compatibility Mode]

Microsoft PowerPoint - Lecture_Note_5.ppt [Compatibility Mode] TCP Server/Client Department of Computer Engineering Kyung Hee University. Choong Seon Hong 1 TCP Server Program Procedure TCP Server socket() bind() 소켓생성 소켓번호와소켓주소의결합 listen() accept() read() 서비스처리, write()

More information

SRC PLUS 제어기 MANUAL

SRC PLUS 제어기 MANUAL ,,,, DE FIN E I N T R E A L L O C E N D SU B E N D S U B M O TIO

More information

프로그램을 학교 등지에서 조금이라도 배운 사람들을 위한 프로그래밍 노트 입니다. 저 역시 그 사람들 중 하나 입니다. 중고등학교 시절 학교 도서관, 새로 생긴 시립 도서관 등을 다니며 책을 보 고 정리하며 어느정도 독학으르 공부하긴 했지만, 자주 안하다 보면 금방 잊어

프로그램을 학교 등지에서 조금이라도 배운 사람들을 위한 프로그래밍 노트 입니다. 저 역시 그 사람들 중 하나 입니다. 중고등학교 시절 학교 도서관, 새로 생긴 시립 도서관 등을 다니며 책을 보 고 정리하며 어느정도 독학으르 공부하긴 했지만, 자주 안하다 보면 금방 잊어 개나리 연구소 C 언어 노트 (tyback.egloos.com) 프로그램을 학교 등지에서 조금이라도 배운 사람들을 위한 프로그래밍 노트 입니다. 저 역시 그 사람들 중 하나 입니다. 중고등학교 시절 학교 도서관, 새로 생긴 시립 도서관 등을 다니며 책을 보 고 정리하며 어느정도 독학으르 공부하긴 했지만, 자주 안하다 보면 금방 잊어먹고 하더라구요. 그래서,

More information

0x00 Contents 0x About Nickster 0x Analaysis 0x Exploit

0x00 Contents 0x About Nickster 0x Analaysis 0x Exploit Defcon CTF 17 th Nickster Report StolenByte(Son Choong-Ho) http://stolenbyte.egloos.com thscndgh_4@hotmail.com WOWHACKER 2009. 08. 09 0x00 Contents 0x01 ------------- About Nickster 0x02 -------------

More information

Microsoft PowerPoint - 12 ¼ÒÄÏÀ» ÀÌ¿ëÇÑ Åë½Å 1.ppt

Microsoft PowerPoint - 12 ¼ÒÄÏÀ» ÀÌ¿ëÇÑ Åë½Å 1.ppt 12 장 소켓을이용한통신 (1) 함수 - inet_addr - inet_ntoa - socket - bind - listen - accept - connect - recv -send 1 서론 파이프를사용하여통신을하기위한시스템호출 / 표준라이브러리함수 함수 의미 inet_addr 문자열형태의인터넷주소를바이너리형태로변환한다. inet_ntoa 바이너리형태의인터넷주소를문자열형태로변환한다.

More information

The Pocket Guide to TCP/IP Sockets: C Version

The Pocket Guide to  TCP/IP Sockets: C Version 얇지만얇지않은 TCP/IP 소켓프로그래밍 C 2 판 4 장 UDP 소켓 제 4 장 UDP 소켓 4.1 UDP 클라이언트 4.2 UDP 서버 4.3 UDP 소켓을이용한데이터송싞및수싞 4.4 UDP 소켓의연결 UDP 소켓의특징 UDP 소켓의특성 싞뢰할수없는데이터젂송방식 목적지에정확하게젂송된다는보장이없음. 별도의처리필요 비연결지향적, 순서바뀌는것이가능 흐름제어 (flow

More information

<4D F736F F F696E74202D20B8AEB4AABDBA20BFC0B7F920C3B3B8AEC7CFB1E22E BC8A3C8AF20B8F0B5E55D>

<4D F736F F F696E74202D20B8AEB4AABDBA20BFC0B7F920C3B3B8AEC7CFB1E22E BC8A3C8AF20B8F0B5E55D> 리눅스 오류처리하기 2007. 11. 28 안효창 라이브러리함수의오류번호얻기 errno 변수기능오류번호를저장한다. 기본형 extern int errno; 헤더파일 라이브러리함수호출에실패했을때함수예 정수값을반환하는함수 -1 반환 open 함수 포인터를반환하는함수 NULL 반환 fopen 함수 2 유닉스 / 리눅스 라이브러리함수의오류번호얻기 19-1

More information

untitled

untitled (shared) (integrated) (stored) (operational) (data) : (DBMS) :, (database) :DBMS File & Database - : - : ( : ) - : - : - :, - DB - - -DBMScatalog meta-data -DBMS -DBMS - -DBMS concurrency control E-R,

More information

untitled

untitled 1 hamks@dongguk.ac.kr (goal) (abstraction), (modularity), (interface) (efficient) (robust) C Unix C Unix (operating system) (network) (compiler) (machine architecture) 1 2 3 4 5 6 7 8 9 10 ANSI C Systems

More information

untitled

untitled Push... 2 Push... 4 Push... 5 Push... 13 Push... 15 1 FORCS Co., LTD A Leader of Enterprise e-business Solution Push (Daemon ), Push Push Observer. Push., Observer. Session. Thread Thread. Observer ID.

More information

Chap06(Interprocess Communication).PDF

Chap06(Interprocess Communication).PDF Interprocess Communication 2002 2 Hyun-Ju Park Introduction (interprocess communication; IPC) IPC data transfer sharing data event notification resource sharing process control Interprocess Communication

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 Socket Programming 1 Jo, Heeseung 학습목표 TCP/IP 프로토콜의기본개념 IP 주소와포트번호의개념소켓관련구조체와함수소켓을이용한통신프로그램을작성 2 TCP/IP 개요 TCP/IP 인터넷의표준프로토콜 5계층 (4계층) 으로구성 TCP 와 UDP 의차이 3 IP 주소와호스트명 IP 주소와호스트명 IP 주소 : 인터넷을이용할때사용하는주소로점

More information

03장.스택.key

03장.스택.key ---------------- DATA STRUCTURES USING C ---------------- 03CHAPTER 1 ? (stack): (LIFO:Last-In First-Out) 2 : top : ( index -1 ),,, 3 : ( ) ( ) -> ->. ->.... 4 Stack ADT : (LIFO) : init():. is_empty():

More information

제1장 Unix란 무엇인가?

제1장  Unix란 무엇인가? 4 장파일 컴퓨터과학과박환수 1 2 4.1 시스템호출 컴퓨터시스템구조 유닉스커널 (kernel) 하드웨어를운영관리하여다음과같은서비스를제공 파일관리 (File management) 프로세스관리 (Process management) 메모리관리 (Memory management) 통신관리 (Communication management) 주변장치관리 (Device

More information

기타자료.PDF

기타자료.PDF < > 1 1 2 1 21 1 22 2 221 2 222 3 223 4 3 5 31 5 311 (netting)5 312 (matching) 5 313 (leading) (lagging)6 314 6 32 6 321 7 322 8 323 13 324 19 325 20 326 20 327 20 33 21 331 (ALM)21 332 VaR(Value at Risk)

More information

제12장 파일 입출력

제12장 파일 입출력 제 4 장파일입출력 리눅스시스템프로그래밍 청주대학교전자공학과 한철수 1 시스템호출 (system call) 파일 (file) 임의접근 (random access) 주요학습내용 2 4.1 절 커널의역할 (kernel) 커널 (kernel) 은운영체제의핵심부분으로서, 하드웨어를운영관리하는여러가지서비스를제공함 파일관리 (File management) 디스크 프로세스관리

More information

PCServerMgmt7

PCServerMgmt7 Web Windows NT/2000 Server DP&NM Lab 1 Contents 2 Windows NT Service Provider Management Application Web UI 3 . PC,, Client/Server Network 4 (1),,, PC Mainframe PC Backbone Server TCP/IP DCS PLC Network

More information

슬라이드 1

슬라이드 1 Task 통신및동기화 : 파이프 (Pipe) Chapter #11 파이프 (Unamed Pipe) 표준입출력과파이프 FIFO(Named Pipe) 강의목차 Unix System Programming 2 파이프 (Unnamed Pipe) 파이프 (Pipe) (1) 하나의프로세스를다른프로세스에연결시켜주는단방향의통신채널 입출력채널과동기화기능을제공하는특수한형태의파일

More information

MPLAB C18 C

MPLAB C18 C MPLAB C18 C MPLAB C18 MPLAB C18 C MPLAB C18 C #define START, c:\mcc18 errorlevel{0 1} char isascii(char ch); list[list_optioin,list_option] OK, Cancel , MPLAB IDE User s Guide MPLAB C18 C

More information

Microsoft PowerPoint - chap13-입출력라이브러리.pptx

Microsoft PowerPoint - chap13-입출력라이브러리.pptx #include int main(void) int num; printf( Please enter an integer: "); scanf("%d", &num); if ( num < 0 ) printf("is negative.\n"); printf("num = %d\n", num); return 0; 1 학습목표 스트림의 기본 개념을 알아보고,

More information

3. 다음장에나오는 sigprocmask 함수의설명을참고하여다음프로그램의출력물과그출력물이화면이표시되는시점을예측하세요. ( 힌트 : 각줄이표시되는시점은다음 4 가지중하나. (1) 프로그램수행직후, (2) kill 명령실행직후, (3) 15 #include <signal.

3. 다음장에나오는 sigprocmask 함수의설명을참고하여다음프로그램의출력물과그출력물이화면이표시되는시점을예측하세요. ( 힌트 : 각줄이표시되는시점은다음 4 가지중하나. (1) 프로그램수행직후, (2) kill 명령실행직후, (3) 15 #include <signal. 학번 : 이름 : 1. 다음가정하에서아래프로그램의출력물을예측하세요. 가정 : 부모프로세스의 process id=20100, 자식프로세스의 process id=20101. int glob = 31; /* external variable in initialized data */ char buf[] = "a write to stdout\n"; int main(void)

More information

MySQL-Ch10

MySQL-Ch10 10 Chapter.,,.,, MySQL. MySQL mysqld MySQL.,. MySQL. MySQL....,.,..,,.,. UNIX, MySQL. mysqladm mysqlgrp. MySQL 608 MySQL(2/e) Chapter 10 MySQL. 10.1 (,, ). UNIX MySQL, /usr/local/mysql/var, /usr/local/mysql/data,

More information

<4D F736F F F696E74202D20C1A63132B0AD20B5BFC0FB20B8DEB8F0B8AEC7D2B4E7>

<4D F736F F F696E74202D20C1A63132B0AD20B5BFC0FB20B8DEB8F0B8AEC7D2B4E7> 제14장 동적 메모리 할당 Dynamic Allocation void * malloc(sizeof(char)*256) void * calloc(sizeof(char), 256) void * realloc(void *, size_t); Self-Referece NODE struct selfref { int n; struct selfref *next; }; Linked

More information

untitled

untitled if( ) ; if( sales > 2000 ) bonus = 200; if( score >= 60 ) printf(".\n"); if( height >= 130 && age >= 10 ) printf(".\n"); if ( temperature < 0 ) printf(".\n"); // printf(" %.\n \n", temperature); // if(

More information

Solaris Express Developer Edition

Solaris Express Developer Edition Solaris Express Developer Edition : 2008 1 Solaris TM Express Developer Edition Solaris OS. Sun / Solaris, Java, Web 2.0,,. Developer Solaris Express Developer Edition System Requirements. 768MB. SPARC

More information

<4D F736F F F696E74202D E20B3D7C6AEBFF6C5A920C7C1B7CEB1D7B7A1B9D62E >

<4D F736F F F696E74202D E20B3D7C6AEBFF6C5A920C7C1B7CEB1D7B7A1B9D62E > 웹프로그래밍및실습 ( g & Practice) 문양세강원대학교 IT 대학컴퓨터과학전공 소켓 (Socket) (1/2) Socket 이란? 서버와클라이언트가서로특정한규약을사용하여데이터를전송하기위한방식 서버와클라이언트는소켓연결을기다렸다가소켓이연결되면서로데이터를전송 현재네트워크상에서의모든통신의근간은 Socket 이라할수있음 Page 2 1 소켓 (Socket) (2/2)

More information

untitled

untitled - -, (insert) (delete) - - (insert) (delete) (top ) - - (insert) (rear) (delete) (front) A A B top A B C top push(a) push(b) push(c) A B top pop() top A B D push(d) top #define MAX_STACK_SIZE 100 int

More information

untitled

untitled CAN BUS RS232 Line Ethernet CAN H/W FIFO RS232 FIFO IP ARP CAN S/W FIFO TERMINAL Emulator COMMAND Interpreter ICMP TCP UDP PROTOCOL Converter TELNET DHCP C2E SW1 CAN RS232 RJ45 Power

More information

T100MD+

T100MD+ User s Manual 100% ) ( x b a a + 1 RX+ TX+ DTR GND TX+ RX+ DTR GND RX+ TX+ DTR GND DSR RX+ TX+ DTR GND DSR [ DCE TYPE ] [ DCE TYPE ] RS232 Format Baud 1 T100MD+

More information

USB USB DV25 DV25 REC SRN-475S REC SRN-475S LAN POWER LAN POWER Quick Network Setup Guide xdsl/cable Modem PC DVR 1~3 1.. DVR DVR IP xdsl Cable xdsl C

USB USB DV25 DV25 REC SRN-475S REC SRN-475S LAN POWER LAN POWER Quick Network Setup Guide xdsl/cable Modem PC DVR 1~3 1.. DVR DVR IP xdsl Cable xdsl C USB USB DV25 DV25 REC SRN-475S REC SRN-475S LAN POWER LAN POWER Quick Network Setup Guide xdsl/cable Modem PC DVR 1~3 1.. DVR DVR IP xdsl Cable xdsl Cable PC PC Step 1~5. Step, PC, DVR Step 1. Cable Step

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 Socket Programming 1 Jo, Heeseung 학습목표 TCP/IP 프로토콜의기본개념 IP 주소와포트번호의개념소켓관련구조체와함수소켓을이용한통신프로그램을작성 2 TCP/IP 개요 TCP/IP 인터넷의표준프로토콜 5 계층 (4 계층 ) 으로구성 TCP 와 UDP 의차이 3 IP 주소와호스트명 IP 주소와호스트명 IP 주소 : 인터넷을이용할때사용하는주소로점

More information

MAX+plus II Getting Started - 무작정따라하기

MAX+plus II Getting Started - 무작정따라하기 무작정 따라하기 2001 10 4 / Version 20-2 0 MAX+plus II Digital, Schematic Capture MAX+plus II, IC, CPLD FPGA (Logic) ALTERA PLD FLEX10K Series EPF10K10QC208-4 MAX+plus II Project, Schematic, Design Compilation,

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 Reasons for Poor Performance Programs 60% Design 20% System 2.5% Database 17.5% Source: ORACLE Performance Tuning 1 SMS TOOL DBA Monitoring TOOL Administration TOOL Performance Insight Backup SQL TUNING

More information

SMB_ICMP_UDP(huichang).PDF

SMB_ICMP_UDP(huichang).PDF SMB(Server Message Block) UDP(User Datagram Protocol) ICMP(Internet Control Message Protocol) SMB (Server Message Block) SMB? : Microsoft IBM, Intel,. Unix NFS. SMB client/server. Client server request

More information

Microsoft PowerPoint - 06-CompSys-16-Socket.ppt

Microsoft PowerPoint - 06-CompSys-16-Socket.ppt 소켓시스템콜소개 TCP 클라이언트 / 서버프로그래밍 signal(), fork() 시스템콜 TCP 클라이언트 / 서버프로그래밍예 talk_client.c, talk_server.c UDP 클라이언트 / 서버프로그래밍 순천향대학교컴퓨터학부이상정 1 소켓시스템콜소개 순천향대학교컴퓨터학부이상정 2 소켓 (socket) 소켓은 TCP/IP 프로토콜을이용하기위한시스템콜인터페이스

More information

<4D F736F F D2034C0E52D554E495820BCD2C4CF20C0C0BFEB20C7C1B7CEB1D7B7A1B9D6>

<4D F736F F D2034C0E52D554E495820BCD2C4CF20C0C0BFEB20C7C1B7CEB1D7B7A1B9D6> 4. UNIX 소켓응용프로그래밍 4.1 소켓의동작모드 소켓의동작모드 blocking, non-blocking, 그리고비동기 (asynchronous) 모드 소켓을처음생성하면 blocking 모드의소켓이생성 blocking 모드소켓 어떤소켓관련시스템콜을호출하였을때네트웍시스템 ( 즉, TCP/IP) 이동작을완료할때까지응용프로세스가멈추어있게 (block) 되는소켓

More information

Microsoft PowerPoint - ch09_파이프 [호환 모드]

Microsoft PowerPoint - ch09_파이프 [호환 모드] 학습목표 파이프를이용한 IPC 기법을이해한다. 이름없는파이프를이용해통신프로그램을작성할수있다. 이름있는파이프를이용해통신프로그램을작성할수있다. 파이프 IT CookBook, 유닉스시스템프로그래밍 2/20 목차 파이프의개념 이름없는파이프만들기 복잡한파이프생성 양방향파이프활용 이름있는파이프만들기 파이프의개념 파이프 두프로세스간에통신할수있도록해주는특수파일 그냥파이프라고하면일반적으로이름없는파이프를의미

More information

2009년 상반기 사업계획

2009년 상반기 사업계획 파이프 IT CookBook, 유닉스시스템프로그래밍 학습목표 파이프를이용한 IPC 기법을이해한다. 이름없는파이프를이용해통신프로그램을작성할수있다. 이름있는파이프를이용해통신프로그램을작성할수있다. 2/20 목차 파이프의개념 이름없는파이프만들기 복잡한파이프생성 양방향파이프활용 이름있는파이프만들기 3/20 파이프의개념 파이프 두프로세스간에통신할수있도록해주는특수파일 그냥파이프라고하면일반적으로이름없는파이프를의미

More information

Microsoft PowerPoint - lab15.pptx

Microsoft PowerPoint - lab15.pptx Mobile & Embedded System Lab. Dept. of Computer Engineering Kyung Hee Univ. TextLCD Device Control in Embedded Linux M3 모듈에장착되어있는 Tedxt LCD 장치를제어하는 App을개발 TextLCD는영문자와숫자일본어, 특수문자를표현하는데사용되는디바이스 HBE-SM5-S4210의

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 @ Lesson 2... ( ). ( ). @ vs. logic data method variable behavior attribute method field Flow (Type), ( ) member @ () : C program Method A ( ) Method B ( ) Method C () program : Java, C++, C# data @ Program

More information

Microsoft Word - Tmax Application Development Guide.doc

Microsoft Word - Tmax Application Development Guide.doc Tmax Application Development Guide Copyright 2000 TmaxSoft Co., Ltd. All Rights Reserved Copyright Notice Copyright 2000 TmaxSoft Co., Ltd. All Rights Reserved. TmaxSoft Co., Ltd. 대한민국서울시강남구대치동 946-1 글라스타워

More information

PWR PWR HDD HDD USB USB Quick Network Setup Guide xdsl/cable Modem PC DVR 1~3 1.. DVR DVR IP xdsl Cable xdsl Cable PC PC DDNS (

PWR PWR HDD HDD USB USB Quick Network Setup Guide xdsl/cable Modem PC DVR 1~3 1.. DVR DVR IP xdsl Cable xdsl Cable PC PC DDNS ( PWR PWR HDD HDD USB USB Quick Network Setup Guide xdsl/cable Modem PC DVR 1~3 1.. DVR DVR IP xdsl Cable xdsl Cable PC PC DDNS (http://ddns.hanwha-security.com) Step 1~5. Step, PC, DVR Step 1. Cable Step

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 @ Lesson 3 if, if else, if else if, switch case for, while, do while break, continue : System.in, args, JOptionPane for (,, ) @ vs. logic data method variable Data Data Flow (Type), ( ) @ Member field

More information

Microsoft PowerPoint - 15-EmbedSW-10-Socket

Microsoft PowerPoint - 15-EmbedSW-10-Socket 10. 소켓개요 TCP 클라이언트 / 서버프로그래밍절차 오드로이드 I/O 소켓프로그램예 순천향대학교컴퓨터공학과이상정 1 소켓 (Socket) 운영체제복습 소켓 (socket) 은통신의극점 (endpoint) 을정의 소켓은 IP 주소와포트번호두가지를접합 (concatenate) 해서구별 두프로세스의네트워크통신에각각하나씩두개의소켓이필요 순천향대학교컴퓨터공학과 2

More information

5.스택(강의자료).key

5.스택(강의자료).key CHP 5: https://www.youtube.com/watch?v=ns-r91557ds ? (stack): (LIFO:Last-In First-Out):. D C B C B C B C B (element) C (top) B (bottom) (DT) : n element : create() ::=. is_empty(s) ::=. is_full(s) ::=.

More information