fixing issues from refactoring
This commit is contained in:
@@ -79,13 +79,6 @@ class SPITSocket {
|
||||
//-------- class --------------
|
||||
SPITSocket(IPAddress ip) : mOwnIp(ip) {
|
||||
m_UDPSocketIP4 = INVALID_SOCKET;
|
||||
|
||||
m_ServerIP = "";
|
||||
m_ServerPort = "";
|
||||
m_ClientIP = "";
|
||||
m_ClientPort = "";
|
||||
m_BoundClientPort = "";
|
||||
m_IsBound = false;
|
||||
createSocket_UDP();
|
||||
}
|
||||
virtual ~SPITSocket() {
|
||||
@@ -101,12 +94,12 @@ class SPITSocket {
|
||||
}
|
||||
|
||||
private:
|
||||
string m_ServerIP;
|
||||
string m_ServerPort;
|
||||
string m_ClientIP;
|
||||
string m_ClientPort; // port given by the user maybe "0"
|
||||
string m_BoundClientPort; // port set after bind
|
||||
bool m_IsBound;
|
||||
string m_ServerIP{};
|
||||
string m_ServerPort{};
|
||||
string m_ClientIP{};
|
||||
string m_ClientPort{}; // port given by the user maybe "0"
|
||||
string m_BoundClientPort{}; // port set after bind
|
||||
bool m_IsBound{};
|
||||
|
||||
public:
|
||||
// Sets the ip address and port for server and client.
|
||||
@@ -124,14 +117,14 @@ class SPITSocket {
|
||||
* @return
|
||||
*/
|
||||
int sendMessage(const char *message, int length) {
|
||||
if (m_ServerPort.length() <= 0)
|
||||
if (m_ServerPort.length() <= 0) {
|
||||
return -1;
|
||||
int intResult;
|
||||
{
|
||||
if (m_IsBound == false)
|
||||
return -1;
|
||||
intResult = sendMessageTo(m_ServerIP, m_ServerPort, message, length);
|
||||
}
|
||||
|
||||
if (m_IsBound == false) {
|
||||
return -1;
|
||||
}
|
||||
int intResult = sendMessageTo(m_ServerIP, m_ServerPort, message, length);
|
||||
return intResult;
|
||||
}
|
||||
|
||||
@@ -139,7 +132,7 @@ class SPITSocket {
|
||||
int setBroadcast(bool p_Broadcast) const;
|
||||
int bindSocket(string clientIp, string clientPort);
|
||||
|
||||
int sendMessageTo(const string& ip, const string&port, const char *message, int msgLength);
|
||||
int sendMessageTo(const string &ip, const string &port, const char *message, int msgLength);
|
||||
|
||||
string getServerIP() const { return m_ServerIP; }
|
||||
string getServerPort() const { return m_ServerPort; }
|
||||
@@ -150,8 +143,7 @@ class SPITSocket {
|
||||
void setIsBound(bool p_IsBound) { m_IsBound = p_IsBound; }
|
||||
bool getIsBound() const { return m_IsBound; }
|
||||
|
||||
private:
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
#endif /* SPITSOCKET_H */
|
||||
|
||||
Reference in New Issue
Block a user