CallDLL ws2_32.dll - help needed

Blitz3D Forums/Blitz3D Beginners Area/CallDLL ws2_32.dll - help needed

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

The following is what I have now:

Print GetHostName$() + " is the computer's hostname"

HOSTENT = GetHostByName( GetHostName$() )
Print PeekInt(HOSTENT ,4) + " is the pointer to the aliases right?"

Print ""
Print "The following bytes are from HOSTENT"
For x = 0 To 15
	Print "Byte (" + x + ") = " +PeekByte (HOSTENT ,x)
Next

WaitKey()
End





Function GetHostByName(LocalHostName$)
	;returns the memory address (integer) to where the HOSTENT is
	Return CallDLL("ws2_32.dll", "gethostbyname",LocalHostName$)
End Function





Function GetHostName$()
	tempbuffer$ = String$(" ", 63)
	tempbank = CreateBank(Len(tempbuffer$)+4)
	PokeByte tempbank,Len(tempbuffer$),4
	CallDLL ("ws2_32.dll", "gethostname", tempbank)
	For temp = 0 To Len(tempbuffer$)-1
		tempbyte = PeekByte (tempbank,temp)
		If tempbyte <> 0 Then tempname$ = tempname$ + Chr$(PeekByte (tempbank,temp))
	Next
	FreeBank tempbank
	Return tempname$
End Function