equal
deleted
inserted
replaced
84 return 0; |
84 return 0; |
85 } |
85 } |
86 |
86 |
87 CAN_HANDLE LIBAPI canOpen_driver(s_BOARD *board) |
87 CAN_HANDLE LIBAPI canOpen_driver(s_BOARD *board) |
88 { |
88 { |
89 Socket* s; |
89 char *dst = "127.0.0.1"; |
|
90 if(!strlen(board->busname)){ |
|
91 dst=board->busname; |
|
92 } |
90 try { |
93 try { |
91 char *dst = "127.0.0.1"; |
94 CAN_HANDLE res = (CAN_HANDLE) new SocketClient(dst, 11898); |
92 if(!strlen(board->busname)){ |
95 return res; |
93 dst=board->busname; |
|
94 } |
|
95 s = new SocketClient(dst, 11898); |
|
96 } |
|
97 catch (const char* _s) { |
|
98 cerr << "can_tcp_win32 exception :\n"; |
|
99 cerr << _s << endl; |
|
100 return NULL; |
|
101 } |
|
102 catch (std::string _s) { |
|
103 cerr << "can_tcp_win32 exception :\n"; |
|
104 cerr << _s << endl; |
|
105 return NULL; |
|
106 } |
96 } |
107 catch (...) { |
97 catch (...) { |
108 cerr << "can_tcp_win32 exception :\n"; |
98 cerr << "can_tcp_win32: couldn't connect to" << dst << endl; |
109 cerr << "unhandled exception\n"; |
|
110 return NULL; |
99 return NULL; |
111 } |
100 } |
112 return (CAN_HANDLE) s; |
|
113 } |
101 } |
114 |
102 |
115 int LIBAPI canClose_driver(CAN_HANDLE inst) |
103 int LIBAPI canClose_driver(CAN_HANDLE inst) |
116 { |
104 { |
117 delete reinterpret_cast<SocketClient*>(inst); |
105 delete reinterpret_cast<SocketClient*>(inst); |