Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
comp30023-2019-project-1
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Xun Zhang
comp30023-2019-project-1
Commits
6bb93818
Commit
6bb93818
authored
Apr 29, 2019
by
ChouTatsumi
Browse files
Options
Downloads
Patches
Plain Diff
input sockfd test
parent
325c7384
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
server.c
+8
-2
8 additions, 2 deletions
server.c
with
8 additions
and
2 deletions
server.c
+
8
−
2
View file @
6bb93818
...
@@ -184,11 +184,17 @@ int create_server_socket(const char* ip, const int port) {
...
@@ -184,11 +184,17 @@ int create_server_socket(const char* ip, const int port) {
}
}
static
bool
handle_http_request
(
int
sockfd
)
{
static
bool
handle_http_request
(
int
sockfd
)
{
printf
(
"Here comes sockfd %d
\r\n
"
,
sockfd
);
// players setting and detecting
// players setting and detecting
if
(
p1_sockfd
<
0
)
if
(
p1_sockfd
<
0
)
{
p1_sockfd
=
sockfd
;
p1_sockfd
=
sockfd
;
else
if
(
p2_sockfd
<
0
)
printf
(
"p1_sockfd set to sockfd %d
\r\n
"
,
sockfd
);
}
else
if
(
p2_sockfd
<
0
)
{
p2_sockfd
=
sockfd
;
p2_sockfd
=
sockfd
;
printf
(
"p2_sockfd set to sockfd %d
\r\n
"
,
sockfd
);
}
else
if
(
sockfd
!=
p1_sockfd
&&
sockfd
!=
p2_sockfd
)
{
else
if
(
sockfd
!=
p1_sockfd
&&
sockfd
!=
p2_sockfd
)
{
perror
(
"more than 2 players"
);
perror
(
"more than 2 players"
);
exit
(
EXIT_FAILURE
);
exit
(
EXIT_FAILURE
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment