forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

are socket newlib socket functions alias to sceNetInet*?

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
Heimdall



Joined: 10 Nov 2005
Posts: 259
Location: Netherlands

PostPosted: Tue Jul 22, 2008 6:22 pm    Post subject: are socket newlib socket functions alias to sceNetInet*? Reply with quote

newlib contains a bsd socket implementation but sony created their own API sceNetInet*, what are the differences between then?

can I code my app using the "standard" bsd socket functions or should I replace all the newlib function names with the sony API something like:

Code:
#define accept sceNetInetAccept
#define bind sceNetInetBind
#define close sceNetInetClose
#define connect sceNetInetConnect
#define getpeername sceNetInetGetpeername
#define getsockname sceNetInetGetsockname
#define getsockopt sceNetInetGetsockopt
#define listen sceNetInetListen
#define recv sceNetInetRecv
#define recvfrom sceNetInetRecvfrom
#define recvmsg sceNetInetRecvmsg
#define send sceNetInetSend
#define sendto sceNetInetSendto
#define sendmsg sceNetInetSendmsg
#define setsockopt sceNetInetSetsockopt
#define shutdown sceNetInetShutdown
#define socket sceNetInetSocket
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Insert_witty_name



Joined: 10 May 2006
Posts: 376

PostPosted: Tue Jul 22, 2008 9:34 pm    Post subject: Reply with quote

The newlib patch implements exactly this, whether you use the newlib functions or sceNetInet*, the sceNetInet* function will be called.
Back to top
View user's profile Send private message
TyRaNiD



Joined: 18 Jan 2004
Posts: 918

PostPosted: Wed Jul 23, 2008 4:02 am    Post subject: Reply with quote

Not quite, the newlib BSD socket library does eventually call down to the sce ones but you cannot mix sockets created on the BSD side with the native side cause it does some mapping to allow you to use them with things like close()/read()/write() etc. You might as well just use the BSD socket layer in the end though for portability.
Back to top
View user's profile Send private message
Heimdall



Joined: 10 Nov 2005
Posts: 259
Location: Netherlands

PostPosted: Wed Jul 23, 2008 5:08 pm    Post subject: Reply with quote

I guess that is my current problem, i've mixed BSD and SCE sockets and when i invoke the connect function from BSD it always returns -1.

And another question, will select() work with SCE socket fd's? or does it require BSD ones?

(i guess this is a dumb question but you said they could conflict on read/write/close).
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
TyRaNiD



Joined: 18 Jan 2004
Posts: 918

PostPosted: Thu Jul 24, 2008 4:07 am    Post subject: Reply with quote

Yah select is the same, it needs sockets created with the BSD interface, it also emulates a real select in that you can also multiplex that select with file descriptors (from open()) which the sceInet one can't do.

You need to choose one or the other I am afraid :/
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group