Skip to content

Network examples #24

@pquerner

Description

@pquerner

Is it possible to add light example code for http networking?
I've read through the sdk chm and tried to get demo code running, however it fails at compiling.

libhttp.h file used https://raw.githubusercontent.com/lammertb/libhttp/master/include/libhttp.h
(dont know if this is correct)

clang  -c source/main.c -std=c11 -O3 -Wall -m64 -mcmodel=large -Wno-zero-length-array -Wno-format-pedantic -I. -Iinclude  -ffreestanding -nostdlib -nostdinc -fno-builtin -fno-stack-protector -D__PS4__ -I/usr/local/ps4dev/ps4sdk/include -I /usr/local/ps4dev/ps4sdk/include/sce -target x86_64-scei-ps4 -fPIE -o build/main.c.o
source/main.c:330:22: warning: implicit declaration of function 'sceHttpCreateTemplate' is invalid in C99 [-Wimplicit-function-declaration]
        templateId = sceHttpCreateTemplate(libhttpCtxId, USER_AGENT,
                     ^
source/main.c:330:44: error: use of undeclared identifier 'libhttpCtxId'
        templateId = sceHttpCreateTemplate(libhttpCtxId, USER_AGENT,
                                           ^
source/main.c:331:44: error: use of undeclared identifier 'SCE_HTTP_VERSION_1_1'
                                           SCE_HTTP_VERSION_1_1, SCE_TRUE);
                                           ^
source/main.c:331:66: error: use of undeclared identifier 'SCE_TRUE'
                                           SCE_HTTP_VERSION_1_1, SCE_TRUE);
                                                                 ^
source/main.c:336:24: warning: implicit declaration of function 'sceHttpCreateConnection' is invalid in C99 [-Wimplicit-function-declaration]
        connectionId = sceHttpCreateConnection(templateId, SERVER, SCHEME,
                       ^
source/main.c:337:54: error: use of undeclared identifier 'SCE_TRUE'
                                               PORT, SCE_TRUE);
                                                     ^
source/main.c:341:27: error: expected expression
        if (connectionId) < 0){
                          ^
source/main.c:350:9: error: use of undeclared identifier 'requestId'
        requestId = sceHttpCreateRequestWithURL(connectionId, SCE_HTTP_METHOD_GET,
        ^
source/main.c:350:21: warning: implicit declaration of function 'sceHttpCreateRequestWithURL' is invalid in C99 [-Wimplicit-function-declaration]
        requestId = sceHttpCreateRequestWithURL(connectionId, SCE_HTTP_METHOD_GET,
                    ^
source/main.c:350:63: error: use of undeclared identifier 'SCE_HTTP_METHOD_GET'
        requestId = sceHttpCreateRequestWithURL(connectionId, SCE_HTTP_METHOD_GET,
                                                              ^
source/main.c:352:10: error: expected expression
        */
         ^
source/main.c:353:9: error: expected expression
        if (requestId < 0){
        ^
source/main.c:361:15: warning: implicit declaration of function 'sceHttpSendRequest' is invalid in C99 [-Wimplicit-function-declaration]
        ret = sceHttpSendRequest(requestId, NULL, 0);
              ^
source/main.c:361:34: error: use of undeclared identifier 'requestId'
        ret = sceHttpSendRequest(requestId, NULL, 0);
                                 ^
source/main.c:367:15: error: expected ';' after expression
        uint64 t contentLength;
              ^
              ;
source/main.c:367:9: error: use of undeclared identifier 'uint64'
        uint64 t contentLength;
        ^
source/main.c:367:16: error: use of undeclared identifier 't'
        uint64 t contentLength;
               ^
source/main.c:370:15: warning: implicit declaration of function 'sceHttpGetStatusCode' is invalid in C99 [-Wimplicit-function-declaration]
        ret = sceHttpGetStatusCode(requestId, &statusCode);
              ^
source/main.c:370:36: error: use of undeclared identifier 'requestId'
        ret = sceHttpGetStatusCode(requestId, &statusCode);
                                   ^
source/main.c:375:15: warning: implicit declaration of function 'sceHttpGetResponseContentLength' is invalid in C99 [-Wimplicit-function-declaration]
        ret = sceHttpGetResponseContentLength(requestId, &result, &contentLength);
              ^
source/main.c:375:47: error: use of undeclared identifier 'requestId'
        ret = sceHttpGetResponseContentLength(requestId, &result, &contentLength);
                                              ^
source/main.c:375:68: error: use of undeclared identifier 'contentLength'
        ret = sceHttpGetResponseContentLength(requestId, &result, &contentLength);
                                                                   ^
6 warnings and 16 errors generated.
/usr/local/ps4dev/ps4sdk/make/ps4sdk.mk:178: recipe for target 'build/main.c.o' failed
make: *** [build/main.c.o] Error 1
LinkerFlags+=-ldebugnet -lps4link -lelfloader -lorbis2d -lorbisPad -lorbisAudio -lorbisXbmFont -lmod -lSceNet_stub -lSceAudioOut_stub -lSceHttp_stub -lSceVideoOut_stub -lSceSystemService_stub -lSceUserService_stub -lSceGnmDriver_stub -lScePad_stub

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions