Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
D
dlib
Project
Project
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
钟尚武
dlib
Commits
4ffd067a
Commit
4ffd067a
authored
Oct 20, 2012
by
Davis King
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added connection::disable_nagle()
parent
90ae4d83
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
48 additions
and
0 deletions
+48
-0
sockets_kernel_1.cpp
dlib/sockets/sockets_kernel_1.cpp
+14
-0
sockets_kernel_1.h
dlib/sockets/sockets_kernel_1.h
+3
-0
sockets_kernel_2.cpp
dlib/sockets/sockets_kernel_2.cpp
+15
-0
sockets_kernel_2.h
dlib/sockets/sockets_kernel_2.h
+3
-0
sockets_kernel_abstract.h
dlib/sockets/sockets_kernel_abstract.h
+13
-0
No files found.
dlib/sockets/sockets_kernel_1.cpp
View file @
4ffd067a
...
...
@@ -266,6 +266,20 @@ namespace dlib
delete
&
connection_socket
;
}
// ----------------------------------------------------------------------------------------
int
connection
::
disable_nagle
()
{
int
flag
=
1
;
int
status
=
setsockopt
(
connection_socket
,
IPPROTO_TCP
,
TCP_NODELAY
,
(
char
*
)
&
flag
,
sizeof
(
flag
)
);
if
(
ret
==
SOCKET_ERROR
)
return
OTHER_ERROR
;
else
return
0
;
}
// ----------------------------------------------------------------------------------------
long
connection
::
...
...
dlib/sockets/sockets_kernel_1.h
View file @
4ffd067a
...
...
@@ -141,6 +141,9 @@ namespace dlib
// as the SOCKET win the windows API.
typedef
unsigned_type
<
void
*>::
type
socket_descriptor_type
;
int
disable_nagle
(
);
socket_descriptor_type
get_socket_descriptor
(
)
const
;
...
...
dlib/sockets/sockets_kernel_2.cpp
View file @
4ffd067a
...
...
@@ -11,6 +11,7 @@
#include "sockets_kernel_2.h"
#include <fcntl.h>
#include "../set.h"
#include <netinet/tcp.h>
...
...
@@ -309,6 +310,20 @@ namespace dlib
sdr
(
0
)
{}
// ----------------------------------------------------------------------------------------
int
connection
::
disable_nagle
()
{
int
flag
=
1
;
if
(
setsockopt
(
connection_socket
,
IPPROTO_TCP
,
TCP_NODELAY
,
(
char
*
)
&
flag
,
sizeof
(
flag
)
))
{
return
OTHER_ERROR
;
}
return
0
;
}
// ----------------------------------------------------------------------------------------
long
connection
::
...
...
dlib/sockets/sockets_kernel_2.h
View file @
4ffd067a
...
...
@@ -183,6 +183,9 @@ namespace dlib
return
temp
;
}
int
disable_nagle
(
);
typedef
int
socket_descriptor_type
;
socket_descriptor_type
get_socket_descriptor
(
...
...
dlib/sockets/sockets_kernel_abstract.h
View file @
4ffd067a
...
...
@@ -362,6 +362,19 @@ namespace dlib
- returns OTHER_ERROR if there was an error
!*/
int
disable_nagle
(
);
/*!
ensures
- Sets the TCP_NODELAY socket option to disable Nagle's algorithm.
This can sometimes reduce transmission latency, however, in almost
all normal cases you don't want to mess with this as the default
setting is usually appropriate.
- returns 0 upon success
- returns OTHER_ERROR if there was an error
!*/
typedef
platform_specific_type
socket_descriptor_type
;
socket_descriptor_type
get_socket_descriptor
(
)
const
;
...
...
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