KatanaNativeInterface
$VERSION$
Main Page
Modules
Namespaces
Classes
Files
File List
File Members
include
KNI
cdlSocket.h
Go to the documentation of this file.
1
/*
2
* Katana Native Interface - A C++ interface to the robot arm Katana.
3
* Copyright (C) 2005 Neuronics AG
4
* Check out the AUTHORS file for detailed contact information.
5
*
6
* This program is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; either version 2 of the License, or
9
* (at your option) any later version.
10
*
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
15
*
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19
*/
20
21
22
23
#ifndef _CDLSOCKET_H_
24
#define _CDLSOCKET_H_
25
26
#include "
common/dllexport.h
"
27
#include "
common/Timer.h
"
28
29
#include "
KNI/cdlBase.h
"
30
#include "
KNI/cdlCOMExceptions.h
"
31
32
//-------------------------------------------------------//
33
#ifdef WIN32
34
//-------------------------------------------------------//
35
#include <windows.h>
36
#include <winsock.h>
37
#include <stdio.h>
38
//-------------------------------------------------------//
39
#else //LINUX
40
//-------------------------------------------------------//
41
#include <sys/types.h>
42
#include <sys/socket.h>
43
#include <netinet/in.h>
44
#include <arpa/inet.h>
45
#include <cerrno>
46
#include <unistd.h>
47
#include <string>
48
//-------------------------------------------------------//
49
#endif //WIN32 else LINUX
50
//-------------------------------------------------------//
51
52
53
//--------------------------------------------------------------------------//
61
class
DLLDIR
CCdlSocket
:
public
CCdlBase
{
62
private
:
64
65
char
*
_ipAddr
;
67
int
_port
;
69
int
_len
;
70
//-------------------------------------------------------//
71
#ifdef WIN32
72
//-------------------------------------------------------//
73
//Windows specific socket handles:
74
SOCKET _socketfd;
75
SOCKADDR_IN _socketAddr;
76
77
//-------------------------------------------------------//
78
#else //LINUX
79
//-------------------------------------------------------//
80
//Unix specific socket handles:
82
int
_socketfd
;
84
struct
sockaddr_in _socketAddr;
85
//-------------------------------------------------------//
86
#endif //WIN32 else LINUX
87
//-------------------------------------------------------//
88
89
protected
:
90
93
static
char
digit
(
const
int
_val) {
94
return
(
char
)((int)
'0'
+ _val);
95
}
96
97
public
:
105
CCdlSocket
(
char
* adress,
int
port);
106
109
virtual
~
CCdlSocket
();
110
113
virtual
int
send
(
const
void
* _buf,
int
_size);
114
117
virtual
int
recv
(
void
* _buf,
int
_size);
118
121
virtual
int
disconnect();
122
};
123
124
125
#endif //_CDLSOCKET_H_
126
Generated by
1.8.1.1