Skip to content

Commit c0c9dd9

Browse files
author
tohanov
committed
bugfix on client compilation on labs' computers
1 parent 98604f7 commit c0c9dd9

6 files changed

Lines changed: 82 additions & 11 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
!.vscode/launch.json
55
!.gitignore
66
!tarCommands.sh
7+
!readme.txt
78

89
!Client
910
!Client/**

Client/makefile

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,15 @@ executable_name:=BGSclient
33
# compile_flags:=-c -Wall -Weffc++ -g -std=c++11 -Iinclude -O3 -pthread
44
# link_flags:=-lboost_system -lpthread -lstdc++ -lboost_thread
55

6-
compile_flags:=-c -Iinclude -pthread -std=c++11 -O3 -Wall -Weffc++ -g
7-
link_flags:=-lboost_system -lboost_thread -lpthread
8-
object_files:= bin/BGSclient.o \
9-
bin/clientConnectionHandler.o \
10-
bin/readFromKeyboardTask.o \
11-
bin/readFromSocketTask.o \
12-
bin/clientProtocol.o \
13-
bin/clientEncoderDecoder.o
6+
compile_flags:=-c -Iinclude -std=c++11 -Wall -Weffc++ -g
7+
link_flags:=-lboost_thread -lboost_system -lpthread -lstdc++ -pthread -L/usr/lib/x86_64-linux-gnu
8+
object_files:= \
9+
bin/BGSclient.o \
10+
bin/clientConnectionHandler.o \
11+
bin/readFromKeyboardTask.o \
12+
bin/readFromSocketTask.o \
13+
bin/clientProtocol.o \
14+
bin/clientEncoderDecoder.o
1415

1516

1617
# all: clear compile link
@@ -33,7 +34,7 @@ compile: client
3334

3435
link: $(object_files)
3536
echo "[*] Linking everything..."
36-
g++ $(link_flags) -o bin/$(executable_name) $(object_files)
37+
g++ $(link_flags) -o bin/$(executable_name) $(object_files) -lboost_system
3738

3839

3940
check: bin/studio ExampleInput.txt #TODO

Client/makefile from group

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
CXX = g++
2+
CXXFLAGS = -c -Wall -Weffc++ -g -std=c++11
3+
CPPFLAGS = -I ./include -MMD -MP
4+
LDFLAGS := -lboost_system -lboost_thread -lpthread
5+
6+
SRCS = $(wildcard ./src/*.cpp)
7+
OBJS = $(patsubst ./src/%.cpp,./bin/%.o, $(SRCS))
8+
DEPS := $(patsubst %.o,%.cpp, $(OBJS))
9+
10+
# default target
11+
all: ./bin/BGSclient
12+
13+
# build studio
14+
./bin/BGSclient: $(OBJS)
15+
@echo "Building ..."
16+
$(CXX) $(OBJS) -o $@ $(LDFLAGS)
17+
@echo "Finished building"
18+
19+
# build cpp files
20+
./bin/%.o: ./src/%.cpp
21+
$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $< -o $@
22+
23+
# clean build files
24+
clean:
25+
@rm -f ./bin/*
26+
27+
-include $(DEPS)

Client/src/clientEncoderDecoder.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ void parseFollowUnfollow(string &output) {
199199
void parseStatLogStat(string &output) {
200200
output += " ";
201201

202-
for (int index = 4; index < bytes.size() /* bytes[index] != ';' */; index += 8) {
202+
for (size_t index = 4; index < bytes.size() /* bytes[index] != ';' */; index += 8) {
203203
// cout << "[*] parseStatLogStat(), inside loop, index=" << index ;
204204
// cout << ", byte=" << bytes[index] << endl;
205205

readme.txt

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
readme.txt:
2+
3+
1) how to run our code:
4+
compilation:
5+
(from the Client directory:)
6+
make
7+
8+
(from the Server directory:)
9+
mvn clean
10+
mvn package
11+
12+
1.1) command line for each server:
13+
(from the Server directory:)
14+
(to run TPC:)
15+
java -jar target/bgs_tpc.jar <port>
16+
17+
(to run Reactor:)
18+
java -jar target/bgs_reactor.jar <num_threads> <port>
19+
20+
1.2) Examples for each command:
21+
22+
register name1 pass123 12-12-2000
23+
register name2 pass123 12-12-2001
24+
25+
login name1 pass1 1
26+
27+
logout
28+
29+
follow 0 name1
30+
follow 1 name1
31+
32+
post the user @name1 listens to me
33+
34+
pm name1 war is bad
35+
36+
logstat
37+
38+
stat name1 name2
39+
40+
block name1
41+
42+
2) We stored the filtered set of word inside HashSet in the static class FilteredWordsWrapper, which is inside the PM_Message class (bgu.spl.net.impl.messages.FilteredWordsWrapper)

tarCommands.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
ARCHIVE=submission.tar.gz
22

3-
tar -czf $ARCHIVE Client/src Client/include/ Client/bin/.gitkeep Client/makefile Server/src/ Server/pom.xml
3+
tar -czf $ARCHIVE Client/src Client/include/ Client/bin/.gitkeep Client/makefile Server/src/ Server/pom.xml readme.txt
44
tar -tvf $ARCHIVE
55

0 commit comments

Comments
 (0)