Very Confused!

BlitzMax Forums/BlitzMax Beginners Area/Very Confused!

Take this code,

Strict

' one udp
Local Udp:tSocket = CreateUDPSocket()
' to recieve
BindSocket (Udp, 49000)
' to send
ConnectSocket (Udp, HostIp ("62.12.76.136"), 49000)

' Send some data
Local b:Byte [] = [Byte(9), Byte(7), Byte(5), Byte(3), Byte(1)]
Udp.send (Varptr b[0], b.length)

' create a loop which waits for some data
While True

	If SocketReadAvail (Udp)
		' a bank to store the input
		Local tmpBank:TBank = CreateBank (1024)
		' size of data-package
		Local length:Int = Udp.recv (BankBuf (tmpBank), tmpBank.size() )
		
		' print data
		For Local i:Int = 0 To length - 1
			Print tmpBank.PeekByte(i)
		Next
		
		' exit this loop 
		Exit
	End If

Wend

CloseSocket (Udp)
End


I know how the code works but how do i know where to find the command "Udp.send" ?? could not find it under sockets. Is it a command?

Welcome to the crazy world of Blitzmax documentation. This is precisely why I don't understand how anybody can tolerate using an object-oriented language with an IDE that doesn't have intellisense.

I generally search the forums more than I use the documentation, although you can find a list of methods for tSocket by clicking on a function name in the Sockets - doesn't matter which, then click on the "Source" function at the top of the page.

It is a method. If it is not documented, your best bet to understand it is by poking around the source of the module.

Thanks guy's. Does BLide make this kind of thing easier?

Yes, although personally I prefer Project Studio.

YES! It definitely does.

Is it documented in Blide? Cool.

Blide is awesome!

Cheers
Charlie

Also have a look for HotDocs.

Is it documented in Blide? Cool.
No, but it does give full intellisense, so you can see all the parameters for a method/function for each object/type.

Just purchased Blide Plus :)

Good call Andy. You will not regret it. ;)

Type TSocket
Method Send( buf:Byte Ptr,count,flags=0 )