Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
bytevia
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Michael Pastushkov
bytevia
Commits
5a381fad
Commit
5a381fad
authored
Sep 18, 2024
by
Michael Pastushkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
working version!! udp
parent
40b88a5c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
13 deletions
+14
-13
src/bytevia.c
+14
-13
No files found.
src/bytevia.c
View file @
5a381fad
...
...
@@ -147,11 +147,11 @@ int encode(unsigned char* buf, int len) {
update_cipher
();
for
(
i
=
0
;
i
<
len
;
i
++
)
buf
[
i
]
=
cipher
[
buf
[
i
]];
//
if (options.log) {
//
printf("\r%-50s", " ");
//
printf("\r%s encode %i bytes ", get_current_timestamp(), len);
//
fflush(stdout);
//
}
if
(
options
.
log
)
{
printf
(
"
\r
%-50s"
,
" "
);
printf
(
"
\r
%s encode %i bytes "
,
get_current_timestamp
(),
len
);
fflush
(
stdout
);
}
return
0
;
}
...
...
@@ -168,11 +168,11 @@ int decode(unsigned char* buf, int len) {
}
}
}
//
if (options.log) {
//
printf("\r%-50s", " ");
//
printf("\r%s decode %i bytes ", get_current_timestamp(), len);
//
fflush(stdout);
//
}
if
(
options
.
log
)
{
printf
(
"
\r
%-50s"
,
" "
);
printf
(
"
\r
%s decode %i bytes "
,
get_current_timestamp
(),
len
);
fflush
(
stdout
);
}
return
0
;
}
...
...
@@ -369,17 +369,18 @@ int use(void)
count_recv
=
recvfrom
(
rc
.
client_socket
,
buffer
,
sizeof
(
buffer
),
MSG_PEEK
,
(
struct
sockaddr
*
)
&
client_addr
,
&
addr_len
);
if
(
count_recv
<
0
)
{
perror
(
"use() - PEEK"
);
return
1
;
}
if
(
rc
.
my_addr
.
sin_port
==
0
)
{
rc
.
my_addr
.
sin_addr
.
s_addr
=
client_addr
.
sin_addr
.
s_addr
;
rc
.
my_addr
.
sin_port
=
client_addr
.
sin_port
;
if
(
options
.
log
>
1
)
if
(
options
.
log
)
printf
(
"my address %s:%d
\t
pid: %d
\n
"
,
inet_ntoa
(
client_addr
.
sin_addr
),
ntohs
(
client_addr
.
sin_port
),
getpid
());
}
else
{
if
(
!
compare_clients
(
rc
.
my_addr
,
client_addr
))
{
if
(
options
.
log
>
1
)
if
(
options
.
log
>
2
)
printf
(
"ignore %s:%d
\t
pid: %d
\n
"
,
inet_ntoa
(
client_addr
.
sin_addr
),
ntohs
(
client_addr
.
sin_port
),
getpid
());
continue
;
// not our business
continue
;
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment