Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
SSE-IoT-Encryption
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Dominik Fuhrmann
SSE-IoT-Encryption
Commits
6273d75d
Commit
6273d75d
authored
6 months ago
by
Elias Maurer
Browse files
Options
Downloads
Patches
Plain Diff
Delete client.c
parent
9fb3a750
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
client.c
+0
-63
0 additions, 63 deletions
client.c
with
0 additions
and
63 deletions
client.c
deleted
100644 → 0
+
0
−
63
View file @
9fb3a750
#include
<stdio.h>
#include
<stdlib.h>
#include
<string.h>
#include
<unistd.h>
#include
<arpa/inet.h>
// #include
#include
<wolfssl/wolfcrypt/settings.h>
#include
<wolfssl/wolfcrypt/aes.h>
// For AES encryption
#include
<wolfssl/wolfcrypt/rsa.h>
// For RSA encryption
#include
<wolfssl/ssl.h>
// #define SERVER_IP "134.103.106.107"
#define SERVER_IP "192.168.58.142"
#define SERVER_PORT 5111
#define BUFFER_SIZE 1024
int
main
()
{
printf
(
"XX"
)
int
sock
;
struct
sockaddr_in
server_addr
;
char
message
[
BUFFER_SIZE
];
// Create socket
sock
=
socket
(
AF_INET
,
SOCK_STREAM
,
0
);
if
(
sock
<
0
)
{
perror
(
"Socket creation failed"
);
return
-
1
;
}
// Define server address
server_addr
.
sin_family
=
AF_INET
;
server_addr
.
sin_port
=
htons
(
SERVER_PORT
);
server_addr
.
sin_addr
.
s_addr
=
inet_addr
(
SERVER_IP
);
// Connect to the server
if
(
connect
(
sock
,
(
struct
sockaddr
*
)
&
server_addr
,
sizeof
(
server_addr
))
<
0
)
{
perror
(
"Connection failed"
);
close
(
sock
);
return
-
1
;
}
printf
(
"Connected to %s:%d
\n
"
,
SERVER_IP
,
SERVER_PORT
);
// Loop for user input and sending messages
while
(
1
)
{
printf
(
"-> "
);
if
(
fgets
(
message
,
sizeof
(
message
),
stdin
)
!=
NULL
)
{
// Remove the newline character from the message
message
[
strcspn
(
message
,
"
\n
"
)]
=
0
;
// Send message to the server
if
(
send
(
sock
,
message
,
strlen
(
message
),
0
)
<
0
)
{
perror
(
"Send failed"
);
break
;
}
}
}
// Close the socket
close
(
sock
);
return
0
;
}
\ No newline at end of file
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