Last change
on this file since b06e647 was
dfec37e,
checked in by VMiklos <vmiklos@…>, at 2007-08-21T18:20:59Z
|
add a simple skyped client for testing purposes
|
-
Property mode set to
100644
|
File size:
859 bytes
|
Line | |
---|
1 | #include <stdio.h> |
---|
2 | #include <stdlib.h> |
---|
3 | #include <string.h> |
---|
4 | #include <unistd.h> |
---|
5 | #include <arpa/inet.h> |
---|
6 | #include <sys/types.h> |
---|
7 | #include <netinet/in.h> |
---|
8 | #include <sys/socket.h> |
---|
9 | |
---|
10 | #define MESSAGE_LEN 1023 |
---|
11 | #define PORTNUM 2727 |
---|
12 | |
---|
13 | char *invoke(int sock, char *cmd) |
---|
14 | { |
---|
15 | char buf[MESSAGE_LEN+1]; |
---|
16 | int len; |
---|
17 | |
---|
18 | write(sock, cmd, strlen(cmd)); |
---|
19 | len = recv(sock, buf, MESSAGE_LEN, 0); |
---|
20 | buf[len] = '\0'; |
---|
21 | return strdup(buf); |
---|
22 | } |
---|
23 | |
---|
24 | int main(int argc, char *argv[]) |
---|
25 | { |
---|
26 | int sock; |
---|
27 | struct sockaddr_in dest; |
---|
28 | char *ptr; |
---|
29 | |
---|
30 | sock = socket(AF_INET, SOCK_STREAM, 0); |
---|
31 | |
---|
32 | memset(&dest, 0, sizeof(dest)); |
---|
33 | dest.sin_family = AF_INET; |
---|
34 | dest.sin_addr.s_addr = inet_addr("127.0.0.1"); |
---|
35 | dest.sin_port = htons(PORTNUM); |
---|
36 | |
---|
37 | connect(sock, (struct sockaddr *)&dest, sizeof(struct sockaddr)); |
---|
38 | |
---|
39 | ptr = invoke(sock, "SET USER foo ISAUTHORIZED FALSE"); |
---|
40 | printf("ptr: '%s'\n", ptr); |
---|
41 | close(sock); |
---|
42 | return(0); |
---|
43 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.