Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
TLMSP curl
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
Container 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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
CYBER - Cyber Security
TS 103 523 MSP
TLMSP
TLMSP curl
Commits
bcfb9ea3
Commit
bcfb9ea3
authored
14 years ago
by
Daniel Stenberg
Browse files
Options
Downloads
Patches
Plain Diff
examples: socket type cleanup
parent
f0aad008
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
docs/examples/evhiperfifo.c
+1
-1
1 addition, 1 deletion
docs/examples/evhiperfifo.c
docs/examples/hiperfifo.c
+1
-1
1 addition, 1 deletion
docs/examples/hiperfifo.c
docs/examples/sendrecv.c
+10
-5
10 additions, 5 deletions
docs/examples/sendrecv.c
with
12 additions
and
7 deletions
docs/examples/evhiperfifo.c
+
1
−
1
View file @
bcfb9ea3
...
...
@@ -367,7 +367,7 @@ static int init_fifo (GlobalInfo *g)
{
struct
stat
st
;
static
const
char
*
fifo
=
"hiper.fifo"
;
in
t
sockfd
;
curl_socket_
t
sockfd
;
fprintf
(
MSG_OUT
,
"Creating named pipe
\"
%s
\"\n
"
,
fifo
);
if
(
lstat
(
fifo
,
&
st
)
==
0
)
...
...
This diff is collapsed.
Click to expand it.
docs/examples/hiperfifo.c
+
1
−
1
View file @
bcfb9ea3
...
...
@@ -350,7 +350,7 @@ static int init_fifo (GlobalInfo *g)
{
struct
stat
st
;
static
const
char
*
fifo
=
"hiper.fifo"
;
in
t
sockfd
;
curl_socket_
t
sockfd
;
fprintf
(
MSG_OUT
,
"Creating named pipe
\"
%s
\"\n
"
,
fifo
);
if
(
lstat
(
fifo
,
&
st
)
==
0
)
{
...
...
This diff is collapsed.
Click to expand it.
docs/examples/sendrecv.c
+
10
−
5
View file @
bcfb9ea3
...
...
@@ -14,7 +14,7 @@
#include
<curl/curl.h>
/* Auxiliary function that waits on the socket. */
static
int
wait_on_socket
(
in
t
sockfd
,
int
for_recv
,
long
timeout_ms
)
static
int
wait_on_socket
(
curl_socket_
t
sockfd
,
int
for_recv
,
long
timeout_ms
)
{
struct
timeval
tv
;
fd_set
infd
,
outfd
,
errfd
;
...
...
@@ -49,7 +49,8 @@ int main(void)
CURLcode
res
;
/* Minimalistic http request */
const
char
*
request
=
"GET / HTTP/1.0
\r\n
Host: example.com
\r\n\r\n
"
;
int
sockfd
;
/* socket */
curl_socket_t
sockfd
;
/* socket */
long
sockextr
;
size_t
iolen
;
curl
=
curl_easy_init
();
...
...
@@ -65,9 +66,11 @@ int main(void)
return
1
;
}
/* Extract the socket from the curl handle - we'll need it
* for waiting */
res
=
curl_easy_getinfo
(
curl
,
CURLINFO_LASTSOCKET
,
&
sockfd
);
/* Extract the socket from the curl handle - we'll need it for waiting.
* Note that this API takes a pointer to a 'long' while we use
* curl_socket_t for sockets otherwise.
*/
res
=
curl_easy_getinfo
(
curl
,
CURLINFO_LASTSOCKET
,
&
sockextr
);
if
(
CURLE_OK
!=
res
)
{
...
...
@@ -75,6 +78,8 @@ int main(void)
return
1
;
}
sockfd
=
sockextr
;
/* wait for the socket to become ready for sending */
if
(
!
wait_on_socket
(
sockfd
,
0
,
60000L
))
{
...
...
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