|
9
|
1 |
/** |
|
0
|
2 |
* @author cramakrishnan |
|
|
3 |
* |
|
|
4 |
* Copyright (C) 2004, C. Ramakrishnan / Illposed Software |
|
|
5 |
* All rights reserved. |
|
|
6 |
* |
|
|
7 |
* See license.txt (or license.rtf) for license information. |
|
|
8 |
* |
|
|
9 |
* |
|
|
10 |
* OSCPort is an abstract superclass. To send OSC messages, use OSCPortOut. |
|
|
11 |
* To listen for OSC messages, use OSCPortIn. |
|
|
12 |
* |
|
|
13 |
*/ |
|
|
14 |
|
|
|
15 |
package com.illposed.osc; |
|
|
16 |
|
|
|
17 |
import java.net.*; |
|
|
18 |
import java.io.IOException; |
|
|
19 |
|
|
|
20 |
public abstract class OSCPort { |
|
|
21 |
|
|
9
|
22 |
protected DatagramSocket socket; |
|
|
23 |
protected int port; |
|
|
24 |
|
|
|
25 |
/** |
|
|
26 |
* The port that the SuperCollider synth engine ususally listens too |
|
|
27 |
*/ |
|
|
28 |
public static final int defaultSCOSCPort = 57110; |
|
|
29 |
|
|
|
30 |
/** |
|
|
31 |
* The port that the SuperCollider language engine ususally listens too |
|
|
32 |
*/ |
|
|
33 |
public static final int defaultSCLangOSCPort = 57120; |
|
|
34 |
|
|
|
35 |
/** |
|
|
36 |
* @see java.lang.Object#finalize() |
|
|
37 |
*/ |
|
|
38 |
protected void finalize() throws Throwable { |
|
|
39 |
super.finalize(); |
|
|
40 |
socket.close(); |
|
|
41 |
} |
|
|
42 |
|
|
|
43 |
/** |
|
|
44 |
* Close the socket and free-up resources. It's recommended that clients call |
|
|
45 |
* this when they are done with the port. |
|
|
46 |
*/ |
|
|
47 |
public void close() { |
|
|
48 |
socket.close(); |
|
|
49 |
} |
|
0
|
50 |
|
|
|
51 |
} |