author | zecke <zecke> | 2002-10-01 14:27:17 (UTC) |
---|---|---|
committer | zecke <zecke> | 2002-10-01 14:27:17 (UTC) |
commit | bba0335bbea81519beafb7fec1979a0abbd8a7ea (patch) (unidiff) | |
tree | ee334cf518c59582a36a3dd24238a05dfc3535a2 /x11/ipc/test | |
parent | ef8d0a15d706b0e230f052efcb1eab6f905a8737 (diff) | |
download | opie-bba0335bbea81519beafb7fec1979a0abbd8a7ea.zip opie-bba0335bbea81519beafb7fec1979a0abbd8a7ea.tar.gz opie-bba0335bbea81519beafb7fec1979a0abbd8a7ea.tar.bz2 |
5th try
initial checkin of X11 Opie stuff
it features an IPC Server
the client is todo
this will become the OPIE X11 department
including
alternative QPEApplication, QCOP replacement
-rw-r--r-- | x11/ipc/test/testcon.c | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/x11/ipc/test/testcon.c b/x11/ipc/test/testcon.c new file mode 100644 index 0000000..22382b1 --- a/dev/null +++ b/x11/ipc/test/testcon.c | |||
@@ -0,0 +1,58 @@ | |||
1 | #include <stdio.h> | ||
2 | #include <stdlib.h> | ||
3 | #include <unistd.h> | ||
4 | |||
5 | #include <sys/socket.h> | ||
6 | #include <sys/un.h> | ||
7 | |||
8 | struct head { | ||
9 | int magic; | ||
10 | int flags; | ||
11 | int chlen; | ||
12 | int funclen; | ||
13 | int datalen; | ||
14 | }; | ||
15 | |||
16 | int main( int argc, char* argv[] ) { | ||
17 | int fd, groesse; | ||
18 | struct sockaddr_un unix_adr; | ||
19 | struct head he; | ||
20 | char* ch = "QPE/System"; | ||
21 | char* fun = "call()"; | ||
22 | int test; | ||
23 | char te; | ||
24 | |||
25 | |||
26 | if( ( fd = socket(PF_UNIX, SOCK_STREAM, 0 ) ) < 0 ){ | ||
27 | printf("Could not socket\n" ); return 0; | ||
28 | } | ||
29 | |||
30 | memset(&unix_adr, 0, sizeof(unix_adr ) ); | ||
31 | unix_adr.sun_family = AF_UNIX; | ||
32 | strcpy(unix_adr.sun_path, "/home/ich/.opie.cop"); | ||
33 | groesse = sizeof(unix_adr.sun_family) + strlen(unix_adr.sun_path); | ||
34 | |||
35 | connect(fd, (struct sockaddr*)&unix_adr, groesse ); | ||
36 | |||
37 | test= 260; | ||
38 | //te = (char)test; | ||
39 | //write(fd,&test,sizeof(test)); | ||
40 | |||
41 | |||
42 | he.magic = 47; | ||
43 | he.flags = 5; | ||
44 | he.chlen = strlen(ch); | ||
45 | he.funclen = strlen(fun); | ||
46 | he.datalen = 0; | ||
47 | |||
48 | for(;;){ | ||
49 | write(fd,&he,sizeof(he) ); | ||
50 | //write(fd,(char*)&he.magic,1); | ||
51 | write(fd,ch,strlen(ch) ); | ||
52 | write(fd,fun,strlen(fun) ); | ||
53 | sleep(5); | ||
54 | }; | ||
55 | |||
56 | |||
57 | |||
58 | } | ||