Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Network examples #24

Open
pquerner opened this issue Dec 30, 2018 · 2 comments
Open

Network examples #24

pquerner opened this issue Dec 30, 2018 · 2 comments

Comments

@pquerner
Copy link

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
@pquerner
Copy link
Author

My understanding now is, that a "wrapper" is missing for now. (Like libdebugnet is a wrapper for the sceSocket stuff)

Maybe https://github.com/vitasdk/samples/blob/master/net_http/src/main.c helps porting this, as it looks quite similar. I will try this evening.

@psxdev
Copy link
Contributor

psxdev commented Jan 3, 2019

you will need add stubs for libraries that are not there right now, check https://github.com/idc/ps4libdoc forn name functions of each stub that you need to use

on ps4sdk check core directory there are the different stubs to generate libraries

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants