Tic Tac 2 Posted May 18, 2015 Author Share Posted May 18, 2015 I'm not familiar with how to make the server and client communicate, e.g server telling client to do something, or client sending information to server.I don't know how it's structured and i think this would help not only me, but a lot of other people. Link to comment Share on other sites More sharing options...
Golf Posted May 19, 2015 Share Posted May 19, 2015 Its really simple…I will show you example how to send message from server to client and open it in message box.This is working for eclipse origins.SERVERIn monEnumerations in enum ServerPackets we will add new packet SSomethingNow in modServerTCP we will add sub:```Sub SendMessageToPlayer(ByVal index as Long,ByVal msg as String)Dim buffer as clsBufferSet buffer = New clsBufferbuffer.writelong SSomethingbuffer.writestring msgsenddatato index,buffer.toarrayset buffer = nothingend sub```Here we write a string and packet and send it to player (index)So when you want to send message write this ```SendMessageToPlayer index,"Hello Eclipse bla bla"```Now we need client side to read the message and show it in message box.In monEnumerations in enum ServerPackets add SSomethingin modHandleData in sub initMessages on the bottom add:```HandleDataSub(SSomething) = GetAddress(AddressOf HandlePlayerMessage)```now in the same module add :```Sub HandlePlayerMessage (ByVal index as long,byref data() as byte,byval Startaddr as long,byval extravar as long)dim msg as stringdim buffer as clsbufferset buffer = new clsbufferbuffer.writebytes datamsg = buffer.readstringmsgbox(msg)set buffer = nothingend sub```Here we will write data we got and read message from it, then show msgbox with new msg.You can do much more this is one of the easiest. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now