blitz3d x2

Blitz3D Forums/Blitz3D Beginners Area/blitz3d x2

dear all
is there a way of opening 2 windowed blitz3d programs & sending messages between them in real time? i would like to open one window with a loaded 3d model & control the model with a gui in the other window.
cheers Shawnus

You can do it with the networking commands, by running one app as the server and the other as the client.

you can goto networking command samples in your blitz commands referance

Thanks for the replies- are there any practical examples of this anywhere where I can examine the code?
Cheers Shawnus

this the code which is available in the command ref.

create a file and place the following
########################################################
; --- Start first code set ---
; Create a server and listen for push

svrGame=CreateTCPServer(8080)

If svrGame<>0 Then
Print "Server started successfully."
Else
Print "Server failed to start."
End
End If

While Not KeyHit(1)
strStream=AcceptTCPStream(svrGame)
If strStream Then
Print ReadString$(strStream)
Delay 2000
End
Else
Print "No word from Apollo X yet ..."
Delay 1000
End If
Wend

End
; --- End first code set ---
########################################################


create another file and copy the following
########################################################


; --- Start second code set ---
; Copy this code to another instance of Blitz Basic
; Run the above code first, then run this ... they will 'talk'

; Create a Client and push data

strmGame=OpenTCPStream("127.0.0.1",8080)

If strmGame<>0 Then
Print "Client Connected successfully."
Else
Print "Server failed to connect."
WaitKey
End
End If

; write stream to server
WriteString strmGame,"Mission Control, this is Apollo X ..."
Print "Completed sending message to Mission control..."

; --- End second code set ---########################################################

enjoy

I've been working on an app like yours. Remember that when you send info treat the stream just like a file. ex:

-------------------------------
"Server App"
Stream = CreateStream()

WriteString "Cool", Stream
WriteInt 4534233, Stream
WriteByte 56, Stream
SendUDPStream Stream, IP, Port

-------------------------------
"Client App"
Stream = CreateUDPStream()

Stream = RecvdUDPStream
ReadString$ = ReadString( Stream )
Integer = ReadInt( Stream )
Byte = ReadByte( Stream )


This helped me out a lot and will probably do the same for you. If you have any other questions I'd be more than happy to help you out.

Thanks guys- I will try.
cheers, Shawnus