|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the License "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 /** |
|
18 * |
|
19 */ |
|
20 package com.nokia.tcf.impl; |
|
21 |
|
22 import org.eclipse.core.runtime.IStatus; |
|
23 |
|
24 import com.nokia.tcf.api.ITCRealTCPConnection; |
|
25 |
|
26 /** |
|
27 * A real TCP/IP connection - used as basis for all TCP/IP connection types |
|
28 */ |
|
29 public class TCRealTCPConnection extends TCBaseConnection implements |
|
30 ITCRealTCPConnection { |
|
31 |
|
32 protected String ipAddress; |
|
33 protected String ipPort; |
|
34 |
|
35 /** |
|
36 * Create TCP Connection with specified IP Address and Port. |
|
37 * Retry times are default. |
|
38 * |
|
39 * @param inIpAddress |
|
40 * @param inIpPort |
|
41 */ |
|
42 public TCRealTCPConnection(String inIpAddress, String inPort) { |
|
43 super(MEDIA_REALTCP); |
|
44 ipAddress = inIpAddress; |
|
45 ipPort = inPort; |
|
46 decodeFormat = "ost"; |
|
47 } |
|
48 /** |
|
49 * Create TCP Connection with specified: |
|
50 * IP Address and port |
|
51 * Retry times |
|
52 * |
|
53 * @param inIpAddress |
|
54 * @param inIpPort |
|
55 * @param retryInterval |
|
56 * @param retryTimeout |
|
57 */ |
|
58 public TCRealTCPConnection(String inIpAddress, String inIpPort, long retryInterval, long retryTimeout) { |
|
59 super(MEDIA_REALTCP, retryInterval, retryTimeout); |
|
60 ipAddress = inIpAddress; |
|
61 ipPort = inIpPort; |
|
62 decodeFormat = "ost"; |
|
63 |
|
64 } |
|
65 /* (non-Javadoc) |
|
66 * @see com.nokia.tcf.internal.TCBaseConnection#getConnectionDescription() |
|
67 */ |
|
68 @Override |
|
69 public String getConnectionDescription() { |
|
70 return "RealTCP/" + ipAddress + "/" + ipPort; |
|
71 } |
|
72 |
|
73 /* (non-Javadoc) |
|
74 * @see com.nokia.tcf.api.ITCRealTCPConnection#getIpAddress() |
|
75 */ |
|
76 public String getIpAddress() { |
|
77 return ipAddress; |
|
78 } |
|
79 |
|
80 /* (non-Javadoc) |
|
81 * @see com.nokia.tcf.api.ITCRealTCPConnection#getIpPort() |
|
82 */ |
|
83 public String getPort() { |
|
84 return ipPort; |
|
85 } |
|
86 |
|
87 /* (non-Javadoc) |
|
88 * @see com.nokia.tcf.api.ITCRealTCPConnection#setIpAddress(java.lang.String) |
|
89 */ |
|
90 public void setIpAddress(String inIpAddress) { |
|
91 ipAddress = inIpAddress; |
|
92 } |
|
93 |
|
94 /* (non-Javadoc) |
|
95 * @see com.nokia.tcf.api.ITCRealTCPConnection#setIpPort(java.lang.String) |
|
96 */ |
|
97 public void setPort(String inPort) { |
|
98 ipPort = inPort; |
|
99 } |
|
100 public IStatus setDecodeFormat(String inDecodeFormat) { |
|
101 return super.setDecodeFormat(inDecodeFormat); |
|
102 } |
|
103 |
|
104 } |