Qbasicnews.com

Full Version: Networking questions (perhaps a C coder could hep me more)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
2 things: First, has anyone got any idea what the socket struct is? I've looked and failed to find one.

Secondly, has anyone ever actually used SDLNet in it's native environment before? I've gotten the following which works right up until the send where it fails. Does the code I have so far seem correct from a C perspective?

Code:
'***************SDLNET****************
result = SDLNet_Init
print "SDL_Init result:", result
                         dim IP as IPAddress
                         dim Socket as any ptr
                         result = SDLNet_ResolveHost (IP, "www.google.com", 80)
                         print "SDLNET_Resolve host result:", result
                         socket = SDLNet_TCP_Open (ip)
                         Send$ = "head /index.html"
                         print *socket
                         result = SDLNet_TCP_Send (socket, @send$, len(send$))
                         print "SDLNet_TCP_Send Result:" ;result; " Should be:";len(send$)
                        
                        

SDLNet_Quit
'**************END SDLNET*************
i did a post earlyer this week with the bare outlines of winsock2
should be under winsock2 stuff
if you mean the type "SOCKET":

typedef UINT_PTR SOCKET;

from winsock2.h
@string$ will pass the address of the descriptor, you have to use sadd( string$ ) to get the address of the string data.

Or you could declare the prototype as BYVAL argname as STRING, as i told ya.. it will be done automatically.
The problem is that this a string being returned, not passed, so you can't go byval.
declare it as byte ptr; the newer versions of fb can convert byte ptr to string