Mercurial > hg > aimc
comparison trunk/external/oscpack/ip/posix/NetworkingUtils.cpp @ 570:4b37b53105a3
Add support for outputting featutes using OSC (for use with the Wekinator, etc).
author | tomwalters@google.com |
---|---|
date | Fri, 22 Jun 2012 12:22:08 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
569:16a590fbc0ba | 570:4b37b53105a3 |
---|---|
1 /* | |
2 oscpack -- Open Sound Control packet manipulation library | |
3 http://www.audiomulch.com/~rossb/oscpack | |
4 | |
5 Copyright (c) 2004-2005 Ross Bencina <rossb@audiomulch.com> | |
6 | |
7 Permission is hereby granted, free of charge, to any person obtaining | |
8 a copy of this software and associated documentation files | |
9 (the "Software"), to deal in the Software without restriction, | |
10 including without limitation the rights to use, copy, modify, merge, | |
11 publish, distribute, sublicense, and/or sell copies of the Software, | |
12 and to permit persons to whom the Software is furnished to do so, | |
13 subject to the following conditions: | |
14 | |
15 The above copyright notice and this permission notice shall be | |
16 included in all copies or substantial portions of the Software. | |
17 | |
18 Any person wishing to distribute modifications to the Software is | |
19 requested to send the modifications to the original developer so that | |
20 they can be incorporated into the canonical version. | |
21 | |
22 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | |
23 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | |
24 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. | |
25 IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR | |
26 ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF | |
27 CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | |
28 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | |
29 */ | |
30 #include "ip/NetworkingUtils.h" | |
31 | |
32 #include <netdb.h> | |
33 #include <sys/socket.h> | |
34 #include <netinet/in.h> | |
35 #include <string.h> | |
36 #include <stdio.h> | |
37 | |
38 | |
39 | |
40 NetworkInitializer::NetworkInitializer() {} | |
41 | |
42 NetworkInitializer::~NetworkInitializer() {} | |
43 | |
44 | |
45 unsigned long GetHostByName( const char *name ) | |
46 { | |
47 unsigned long result = 0; | |
48 | |
49 struct hostent *h = gethostbyname( name ); | |
50 if( h ){ | |
51 struct in_addr a; | |
52 memcpy( &a, h->h_addr_list[0], h->h_length ); | |
53 result = ntohl(a.s_addr); | |
54 } | |
55 | |
56 return result; | |
57 } |