BlinkenArea commited on 2011-12-28 01:17:37
Showing 3 changed files, with 12 additions and 0 deletions.
| ... | ... |
@@ -27,6 +27,9 @@ public: |
| 27 | 27 |
/// return port (use this function only if absolutely necessary) |
| 28 | 28 |
virtual int getPort() const = 0; |
| 29 | 29 |
|
| 30 |
+ /// set port (use this function only if absolutely necessary) |
|
| 31 |
+ virtual void setPort(int port) = 0; |
|
| 32 |
+ |
|
| 30 | 33 |
/** |
| 31 | 34 |
* @brief parse from string format |
| 32 | 35 |
* @param[in] str string format |
| ... | ... |
@@ -92,6 +92,12 @@ int Udp4Addr::getPort() const |
| 92 | 92 |
return ntohs(m_addr.sin_port); |
| 93 | 93 |
} |
| 94 | 94 |
|
| 95 |
+/// set port (use this function only if absolutely necessary) |
|
| 96 |
+void Udp4Addr::setPort(int port) |
|
| 97 |
+{
|
|
| 98 |
+ m_addr.sin_port = htons(port); |
|
| 99 |
+} |
|
| 100 |
+ |
|
| 95 | 101 |
/** |
| 96 | 102 |
* @brief parse from string format |
| 97 | 103 |
* @param[in] str string format |
| ... | ... |
@@ -43,6 +43,9 @@ public: |
| 43 | 43 |
/// return port (use this function only if absolutely necessary) |
| 44 | 44 |
virtual int getPort() const; |
| 45 | 45 |
|
| 46 |
+ /// set port (use this function only if absolutely necessary) |
|
| 47 |
+ virtual void setPort(int port); |
|
| 48 |
+ |
|
| 46 | 49 |
/** |
| 47 | 50 |
* @brief parse from string format |
| 48 | 51 |
* @param[in] str string format |
| 49 | 52 |