| 1 |
September 28, 2005 |
|---|
| 2 |
------------------ |
|---|
| 3 |
|
|---|
| 4 |
Compared to the previous official snapshot (November 2004) the |
|---|
| 5 |
current version of oscpack includes a re-written set of network |
|---|
| 6 |
classes and some changes to the syntax of the networking code. It no |
|---|
| 7 |
longer uses threads, which means that you don't need to use sleep() |
|---|
| 8 |
if you are writing a simple single-threaded server, or you need to |
|---|
| 9 |
spawn your own threads in a more complex application. |
|---|
| 10 |
|
|---|
| 11 |
The list below summarises the changes if you are porting code from |
|---|
| 12 |
the previous release. |
|---|
| 13 |
|
|---|
| 14 |
- there are no longer any threads in oscpack. if you need to |
|---|
| 15 |
set up an asynchronous listener you can create your own thread |
|---|
| 16 |
and call Run on an instance of SocketReceiveMultiplexer or |
|---|
| 17 |
UdpListeningReceiveSocket (see ip/UdpSocket.h) yourself. |
|---|
| 18 |
|
|---|
| 19 |
- host byte order is now used for network (IP) addresses |
|---|
| 20 |
|
|---|
| 21 |
- functions which used to take two parameters <address, port> |
|---|
| 22 |
now take an instance of IpEndpointName (see |
|---|
| 23 |
ip/IpEndpointName.h) this class has a number of convenient |
|---|
| 24 |
constructors for converting numbers and strings to internet |
|---|
| 25 |
addresses. For example there is one which takes a string and |
|---|
| 26 |
another that take the dotted address components as separate |
|---|
| 27 |
parameters. |
|---|
| 28 |
|
|---|
| 29 |
- The UdpTransmitPort class, formerly in UdpTransmitPort.h, is |
|---|
| 30 |
now called UdpTransmitSocket, which is simply a convenience |
|---|
| 31 |
class derived from UdpSocket (see ip/UdpSocket.h). Where you |
|---|
| 32 |
used to use the constructor UdpTransmitPort( address, port) now |
|---|
| 33 |
you can use UdpTransmitSocket( IpEndpointName( address, port ) |
|---|
| 34 |
) or you can any of the other possible ctors to IpEndpointName |
|---|
| 35 |
() (see above). The Send() method is unchanged. |
|---|
| 36 |
|
|---|
| 37 |
- The packet listener base class is now located in |
|---|
| 38 |
ip/PacketListener.h instead of PacketListenerPort.h. The |
|---|
| 39 |
ProcessPacket method now has an additional parameter indicating |
|---|
| 40 |
the remote endpoint |
|---|
| 41 |
|
|---|
| 42 |
- The preferred way to set up listeners is with |
|---|
| 43 |
SocketReceiveMultiplexer (in ip/UdpSocket.h), this also allows |
|---|
| 44 |
attaching periodic timers. For simple applications which only |
|---|
| 45 |
listen to a single socket with no timers you can use |
|---|
| 46 |
UdpListeningReceiveSocket (also in UdpSocket.h) See |
|---|
| 47 |
osc/OscReceiveTest.cpp or osc/OscDump.cpp for examples of this. |
|---|
| 48 |
This is more or less equivalent to the UdpPacketListenerPort |
|---|
| 49 |
object in the old oscpack versions except that you need to |
|---|
| 50 |
explicitly call Run() before it will start receiving packets |
|---|
| 51 |
and it runs in the same thread, not a separate thread so Run() |
|---|
| 52 |
won't usually return. |
|---|
| 53 |
|
|---|
| 54 |
- Explicit calls to InitializeNetworking() and |
|---|
| 55 |
TerminateNetworking() are no longer required for simple |
|---|
| 56 |
applications (more complex windows applications should |
|---|
| 57 |
instantiate NetworkInitializer in main() or WinMain (see |
|---|
| 58 |
ip/NetworkingUtils.h/.cpp) |
|---|
| 59 |
|
|---|
| 60 |
- The OscPacketListener base class (OscPacketListener.h) was |
|---|
| 61 |
added to make traversing OSC packets easier, it handles bundle |
|---|
| 62 |
traversal automatically so you only need to process messages in |
|---|
| 63 |
your derived classes. |
|---|
| 64 |
|
|---|
| 65 |
- On Windows be sure to link with ws2_32.lib or you will see |
|---|
| 66 |
a linker error about WSAEventSelect not being found. Also you |
|---|
| 67 |
will need to link with winmm.lib for timeGetTime() |
|---|
| 68 |
|
|---|