| View previous topic :: View next topic |
| Author |
Message |
Heimdall
Joined: 10 Nov 2005 Posts: 259 Location: Netherlands
|
Posted: Tue Jul 22, 2008 6:22 pm Post subject: are socket newlib socket functions alias to sceNetInet*? |
|
|
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 |
|
 |
Insert_witty_name
Joined: 10 May 2006 Posts: 376
|
Posted: Tue Jul 22, 2008 9:34 pm Post subject: |
|
|
| The newlib patch implements exactly this, whether you use the newlib functions or sceNetInet*, the sceNetInet* function will be called. |
|
| Back to top |
|
 |
TyRaNiD
Joined: 18 Jan 2004 Posts: 918
|
Posted: Wed Jul 23, 2008 4:02 am Post subject: |
|
|
| 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 |
|
 |
Heimdall
Joined: 10 Nov 2005 Posts: 259 Location: Netherlands
|
Posted: Wed Jul 23, 2008 5:08 pm Post subject: |
|
|
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 |
|
 |
TyRaNiD
Joined: 18 Jan 2004 Posts: 918
|
Posted: Thu Jul 24, 2008 4:07 am Post subject: |
|
|
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 |
|
 |
|