gcc484ntopperl-5.22
Last change
on this file since c5c522c was
c5c522c,
checked in by Edwin Eefting <edwin@datux.nl>, 8 years ago
|
initial commit, transferred from cleaned syn3 svn tree
|
-
Property mode set to
100644
|
File size:
736 bytes
|
Line | |
---|
1 | #include <stdlib.h> |
---|
2 | #include <stdio.h> |
---|
3 | #include <string.h> |
---|
4 | #include <fcntl.h> |
---|
5 | |
---|
6 | #define LCDPORT 13667 |
---|
7 | |
---|
8 | #include "../shared/sockets.h" |
---|
9 | |
---|
10 | |
---|
11 | int main() |
---|
12 | { |
---|
13 | char string[1024]; |
---|
14 | char string2[1024]; |
---|
15 | int sock; |
---|
16 | int err; |
---|
17 | |
---|
18 | memset(string, 0, 1024); |
---|
19 | |
---|
20 | fcntl(stdin, F_SETFL, O_NONBLOCK); |
---|
21 | |
---|
22 | sock = sock_connect("localhost", LCDPORT); |
---|
23 | |
---|
24 | if(sock <= 0) |
---|
25 | { |
---|
26 | printf("Error opening socket.\n"); |
---|
27 | return 1; |
---|
28 | } |
---|
29 | |
---|
30 | |
---|
31 | while(string[0] != 'q') |
---|
32 | { |
---|
33 | do { |
---|
34 | err = sock_recv(sock, string2, 1024); |
---|
35 | if (err > 0) printf("Received message: %s\n", string2); |
---|
36 | } while(err > 0); |
---|
37 | printf("Enter a string to send:\n\t"); |
---|
38 | gets(string); |
---|
39 | sock_send_string(sock, string); |
---|
40 | } |
---|
41 | sock_close(sock); |
---|
42 | |
---|
43 | return 0; |
---|
44 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.