source: BAORadio/libindi/v1/BAOTest/simple_client_main.cpp @ 612

Last change on this file since 612 was 490, checked in by campagne, 14 years ago

import libindi (JEC)

File size: 671 bytes
Line 
1#include "ClientSocket.h"
2#include "SocketException.h"
3#include <iostream>
4#include <string>
5#include <stdio.h>
6
7int main ( int argc, int argv[] )
8{
9  try
10    {
11
12      ClientSocket client_socket ( "192.168.0.1", 8000 );
13
14      std::string reply;
15char chaine[20];
16int i=0;
17
18while(true)
19{
20i++;
21      try
22        {
23sprintf(chaine,"client %i-",i);
24          client_socket << "Client : " << chaine << "\"\n";
25          client_socket >> reply;
26        }
27      catch ( SocketException& e) {
28std::cout  << e.description() << "\n";
29break;
30}
31
32      std::cout <<  reply ;
33
34}
35    }
36  catch ( SocketException& e )
37    {
38      std::cout << "Exception was caught:" << e.description() << "\n";
39    }
40
41  return 0;
42}
Note: See TracBrowser for help on using the repository browser.