-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathConnectCommand.cpp
More file actions
30 lines (26 loc) · 834 Bytes
/
Copy pathConnectCommand.cpp
File metadata and controls
30 lines (26 loc) · 834 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
//
// Created by roy on 12/23/18.
//
#include "ConnectCommand.h"
using namespace std;
/**
* Constructor of connect command, receives data sender pointer to be connected to the server.
* @param newIp ip for the connection.
* @param newPort port for the connection.
* @param newDataSender data sender pointer to be connected.
*/
ConnectCommand::ConnectCommand(string newIp, string newPort, DataSender *newDataSender) {
ip = newIp;
port = newPort;
dataSender = newDataSender;
}
/**
* This method executes the connection of the data sender to the given ip and port.
* It opens the connection with a socket.
* @return jump for the lexer.
*/
int ConnectCommand::execute() {
dataSender->set(ip, port);
dataSender->openPipe(); //SCAT for now
return JUMP_CONNECT_INDEX; //moves the lexer to next content
}