bkabka
This commit is contained in:
parent
b5b395890f
commit
8a28cb787b
@ -13,10 +13,8 @@
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="97f792d3-056a-4080-95c1-9466c7ec0ade" name="Default Changelist" comment="">
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/EasySockets.h" beforeDir="false" afterPath="$PROJECT_DIR$/EasySockets.h" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Game.h" beforeDir="false" afterPath="$PROJECT_DIR$/Game.h" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/ProjektDSIK.dir/C.includecache" beforeDir="false" afterPath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/ProjektDSIK.dir/C.includecache" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/ProjektDSIK.dir/main.c.o" beforeDir="false" afterPath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/ProjektDSIK.dir/main.c.o" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/clion-log.txt" beforeDir="false" afterPath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/clion-log.txt" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/cmake-build-debug/ProjektDSIK" beforeDir="false" afterPath="$PROJECT_DIR$/cmake-build-debug/ProjektDSIK" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/main.c" beforeDir="false" afterPath="$PROJECT_DIR$/main.c" afterDir="false" />
|
||||
</list>
|
||||
@ -45,8 +43,8 @@
|
||||
<file pinned="false" current-in-tab="true">
|
||||
<entry file="file://$PROJECT_DIR$/main.c">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="343">
|
||||
<caret line="65" column="5" lean-forward="true" selection-start-line="65" selection-start-column="5" selection-end-line="65" selection-end-column="5" />
|
||||
<state relative-caret-position="251">
|
||||
<caret line="87" column="21" selection-start-line="87" selection-start-column="21" selection-end-line="87" selection-end-column="21" />
|
||||
<folding>
|
||||
<element signature="e#0#18#0" expanded="true" />
|
||||
</folding>
|
||||
@ -54,6 +52,24 @@
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/cmake-build-debug/recv">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="150">
|
||||
<caret line="10" column="2" lean-forward="true" selection-start-line="10" selection-start-column="2" selection-end-line="10" selection-end-column="2" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file pinned="false" current-in-tab="false">
|
||||
<entry file="file:///usr/include/fcntl.h">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="237">
|
||||
<caret line="167" column="11" selection-start-line="167" selection-start-column="11" selection-end-line="167" selection-end-column="11" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/Player.h">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
@ -139,6 +155,11 @@
|
||||
<item name="ProjektDSIK" type="b2602c69:ProjectViewProjectNode" />
|
||||
<item name="DSIK_C" type="462c0819:PsiDirectoryNode" />
|
||||
</path>
|
||||
<path>
|
||||
<item name="ProjektDSIK" type="b2602c69:ProjectViewProjectNode" />
|
||||
<item name="DSIK_C" type="462c0819:PsiDirectoryNode" />
|
||||
<item name="cmake-build-debug" type="462c0819:PsiDirectoryNode" />
|
||||
</path>
|
||||
</expand>
|
||||
<select />
|
||||
</subPane>
|
||||
@ -182,12 +203,20 @@
|
||||
<workItem from="1572428271418" duration="2763000" />
|
||||
<workItem from="1572532173908" duration="3927000" />
|
||||
<workItem from="1572542490103" duration="11691000" />
|
||||
<workItem from="1572708950669" duration="1505000" />
|
||||
<workItem from="1572708950669" duration="3690000" />
|
||||
</task>
|
||||
<task id="LOCAL-00001" summary="bkabka">
|
||||
<created>1572716481980</created>
|
||||
<option name="number" value="00001" />
|
||||
<option name="presentableId" value="LOCAL-00001" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1572716481981</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="2" />
|
||||
<servers />
|
||||
</component>
|
||||
<component name="TimeTrackingManager">
|
||||
<option name="totallyTimeSpent" value="19886000" />
|
||||
<option name="totallyTimeSpent" value="22071000" />
|
||||
</component>
|
||||
<component name="ToolWindowManager">
|
||||
<frame x="0" y="31" width="1600" height="869" extended-state="6" />
|
||||
@ -198,7 +227,7 @@
|
||||
<window_info id="Favorites" order="2" side_tool="true" />
|
||||
<window_info anchor="bottom" id="Message" order="0" />
|
||||
<window_info anchor="bottom" id="Find" order="1" />
|
||||
<window_info anchor="bottom" id="Run" order="2" weight="0.32791328" />
|
||||
<window_info active="true" anchor="bottom" id="Run" order="2" visible="true" weight="0.32791328" />
|
||||
<window_info anchor="bottom" id="Debug" order="3" weight="0.398374" />
|
||||
<window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
|
||||
<window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
|
||||
@ -220,12 +249,16 @@
|
||||
<component name="TypeScriptGeneratedFilesManager">
|
||||
<option name="version" value="1" />
|
||||
</component>
|
||||
<component name="VcsManagerConfiguration">
|
||||
<MESSAGE value="bkabka" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="bkabka" />
|
||||
</component>
|
||||
<component name="XDebuggerManager">
|
||||
<breakpoint-manager>
|
||||
<breakpoints>
|
||||
<line-breakpoint enabled="true" type="com.jetbrains.cidr.execution.debugger.OCBreakpointType">
|
||||
<url>file://$PROJECT_DIR$/main.c</url>
|
||||
<line>77</line>
|
||||
<line>81</line>
|
||||
<option name="timeStamp" value="17" />
|
||||
</line-breakpoint>
|
||||
</breakpoints>
|
||||
@ -290,10 +323,24 @@
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file:///usr/include/fcntl.h">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="237">
|
||||
<caret line="167" column="11" selection-start-line="167" selection-start-column="11" selection-end-line="167" selection-end-column="11" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/cmake-build-debug/recv">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="150">
|
||||
<caret line="10" column="2" lean-forward="true" selection-start-line="10" selection-start-column="2" selection-end-line="10" selection-end-column="2" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/main.c">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="343">
|
||||
<caret line="65" column="5" lean-forward="true" selection-start-line="65" selection-start-column="5" selection-end-line="65" selection-end-column="5" />
|
||||
<state relative-caret-position="251">
|
||||
<caret line="87" column="21" selection-start-line="87" selection-start-column="21" selection-end-line="87" selection-end-column="21" />
|
||||
<folding>
|
||||
<element signature="e#0#18#0" expanded="true" />
|
||||
</folding>
|
||||
|
@ -67,6 +67,8 @@ netdb.h
|
||||
-
|
||||
pthread.h
|
||||
-
|
||||
fcntl.h
|
||||
-
|
||||
EasySockets.h
|
||||
/home/emile/DSIK_C/EasySockets.h
|
||||
Game.h
|
||||
|
Binary file not shown.
Binary file not shown.
24
main.c
24
main.c
@ -8,6 +8,7 @@
|
||||
#include <arpa/inet.h>
|
||||
#include <netdb.h>
|
||||
#include <pthread.h>
|
||||
#include <fcntl.h>
|
||||
#include "EasySockets.h"
|
||||
#include "Game.h"
|
||||
#include "LinkedList.h"
|
||||
@ -42,6 +43,7 @@ void InterpretReceivedSignal(Player* p, const char* buffer, int len, bool* fileS
|
||||
}else if (buffer[0] == 'f'){
|
||||
*fileSwitch=true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
int series =0;
|
||||
@ -72,17 +74,35 @@ void* PlayerDataReaderThread(void* arg){
|
||||
printf("%d", p->points);
|
||||
socklen_t size = sizeof(p->incoming);
|
||||
bool isFile=false;
|
||||
FILE* fileHandle = NULL;
|
||||
while (true) {
|
||||
int s = recv(p->connectionId, buffer, 1000, 0);
|
||||
int s = recv(p->connectionId, buffer, 550, 0);
|
||||
if (s>0) {
|
||||
InterpretReceivedSignal(p, buffer, 1000,&isFile);
|
||||
if (!isFile)
|
||||
{InterpretReceivedSignal(p, buffer, 550,&isFile);
|
||||
continue;}
|
||||
if (isFile){
|
||||
printf("is file \n");
|
||||
if (fileHandle==NULL) fileHandle=fopen("recv", "w+");
|
||||
//receiving the file in parts
|
||||
printf("buffer content: %s\n", buffer);
|
||||
fwrite(buffer,s,1,fileHandle);
|
||||
if (s<550){
|
||||
printf("ended receiving file...\n");
|
||||
//if not data was received
|
||||
fflush(fileHandle);
|
||||
fclose(fileHandle);
|
||||
isFile=false;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (state >0)
|
||||
UpdateStateToClients();
|
||||
|
||||
}else{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user