23.kraft Posted February 19, 2011 Author Share Posted February 19, 2011 Could you advise me a book where it says how the TSP system origins Eclipse client server? Thanks in advance (recommended links) Link to comment Share on other sites More sharing options...
Joyce Posted February 19, 2011 Share Posted February 19, 2011 Not quite sure what you mean, but as far as I know EO still uses Winsock.. If that's what you're asking, your question is quite unclear. Link to comment Share on other sites More sharing options...
23.kraft Posted February 19, 2011 Author Share Posted February 19, 2011 I know that you are using Winsock) I have a couple of examples of using Winsock, but in Eclipse origins Winsock uses more complicated. So I want to understand how this system works in Eclipse origins. Link to comment Share on other sites More sharing options...
frankpetrov Posted February 19, 2011 Share Posted February 19, 2011 winsock is winsock. EO uses winsock, but i believe it uses it's own way of encryption. Link to comment Share on other sites More sharing options...
23.kraft Posted February 19, 2011 Author Share Posted February 19, 2011 I just can not figure out how to work in Eclipse origins SendData / GetData. Link to comment Share on other sites More sharing options...
Joyce Posted February 19, 2011 Share Posted February 19, 2011 Ah, it's a tad complicated and awkward yes.. Look at the existing packets, and search for the related variables and such.. Then backup your source and go trial and error. :) I'd write something more detailed but I'm tired as heeeell Link to comment Share on other sites More sharing options...
23.kraft Posted February 19, 2011 Author Share Posted February 19, 2011 You probably think that I am writing here is so simple! the point is that I no longer have the options I used all that I only know ( Link to comment Share on other sites More sharing options...
Joyce Posted February 19, 2011 Share Posted February 19, 2011 ModEnumerationModClientTCP/ModServerTCPModHandleDataLook through those, they all pretty much show how to use the system, if you look thoroughly enough. Again, I'm tired as hell and I'm helping to the best I can without giving myself a gruesome headache. Please be patient and look through what I just pointed at, or if you're too lazy to figure stuff out wait for someone to write a tutorial. Link to comment Share on other sites More sharing options...
23.kraft Posted February 19, 2011 Author Share Posted February 19, 2011 I'll tell you a secret I've tried everything and still looking (but still I can not understand how it works over the lazy I have puzzled etoi problem 18 hours. Link to comment Share on other sites More sharing options...
23.kraft Posted February 19, 2011 Author Share Posted February 19, 2011 to be honest I can help just one example (when I attack the NPC so that window pops) Link to comment Share on other sites More sharing options...
Robin Posted February 19, 2011 Share Posted February 19, 2011 Just look at the existing packets. Link to comment Share on other sites More sharing options...
23.kraft Posted February 19, 2011 Author Share Posted February 19, 2011 I tried for 2 examples (the quest, and HP) Link to comment Share on other sites More sharing options...
23.kraft Posted February 19, 2011 Author Share Posted February 19, 2011 for example, the quest everything works but I can not understand the principle of work (to create their own) Link to comment Share on other sites More sharing options...
Rob Janes Posted February 19, 2011 Share Posted February 19, 2011 This is a loaded question; it's hard to dig right in and ask how packets are sent back and forth.Robin created a very nice custom class which gets used as a buffer when sending packets. Whenever you're sending data in either direction, you first declare your new buffer as a clsBuffer, then you give it a long variable which defines how the client or server will read the packet and handle it.Example, let's make a button on frmMain, and send the words 'Hello Server!' to the server and have the server sent a message back to the client!1\. Create a button on frmMain, call it cmdHello, give it the following backend code```dim buffer as clsBuffer 'Setting up the bufferdim tmpString as String 'tmpString which will hold the 'Hello Server!tmpString = "Hello Server!" 'See, we now have a string variable defined that we will send..dur...set buffer = new clsBuffer 'We're now setting it as a new buffer.buffer.writeLong CSendHelloServer 'This CSendHelloServer is what gets sent 'first and will let the server know what command has been sentbuffer.writeString tmpString 'We're writing the tmpString (Hello Server) to the bufferSendData buffer.toarray() 'We've actually sent the packetset buffer = nothing ' Close the buffer```Step 2\. Now, if you noticed, we IDed that packet as CSendHelloServer, we put C first because it's coming from the client. The server won't know what CSendHelloServer means unless we declare it first. Inside the SERVER and the CLIENT in modEnumerations, where it defines all the client packets add.```CSendHelloServer```Step 3. Now we need to make the SERVER handle the data that is being sent. If you look in modHandleData, the initMessages function. What we are going to do is add a new Handler for CSendHelloServer, so add this to the bottom of InitMessages. If you look, we're bascially looking at the packet, noticing it's identified as CSendHelloServer and we're calling the HandleHelloServer Sub!```HandleDataSub(CSendHelloServer) = GetAddress(AddressOf HandleHelloServer) ```Step 4\. We're now going to add the HandleHelloServer sub, add the following new Sub to the bottom of modHandleData on the Server.```Sub HandleGetLoot(ByVal index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long) Dim buffer As clsBuffer 'Declaring the buffer Dim tmpString As Long 'Declaring the tmpString that will handle the data we sent Set buffer = New clsBuffer 'Setup the buffer buffer.WriteBytes Data() 'Write everything! tmpString = buffer.ReadString 'Read the String that we wrote if tmpString = "Hello Server!" then 'If our Message was Hello Server, say Hi back! Call PlayerMsg(index, "Hello Client!", Yellow) else 'If our message wasn't Hello Server, make it say What? Call PlayerMsg(index, "What?", Yellow) end if Set buffer = Nothing 'Clear the bufferEnd Sub```Hope this helps explain the traffic process a bit easier Link to comment Share on other sites More sharing options...
23.kraft Posted February 19, 2011 Author Share Posted February 19, 2011 gives an error "tmp String = buffer.Read String 'Read the String that we wrote"clarify sdes "Sub HandleGetLoot (ByVal index As Long, ByRef Data () As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long"should be so: Sub HandleHelloServer (ByVal index As Long, ByRef Data () As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long "? Link to comment Share on other sites More sharing options...
23.kraft Posted February 19, 2011 Author Share Posted February 19, 2011 thank you figured out the type is not valid was specified))) Link to comment Share on other sites More sharing options...
Rob Janes Posted February 19, 2011 Share Posted February 19, 2011 Yeah ignore the GetLoot part, I just copied my own code and forgot to replace ;) Link to comment Share on other sites More sharing options...
23.kraft Posted February 20, 2011 Author Share Posted February 20, 2011 I tried to make myself) but the error "SendData Buffer.ToArray ()" (wrote that the Sub or Function not defined)I did the following:i will continue your code called "Hello server!"I ordered on the server:0)SSendHelloServer1)Sub HandleHelloServer(ByVal index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)Dim Buffer As clsBufferDim tmpString As String Dim tmpStrin As StringSet Buffer = New clsBufferBuffer.WriteBytes Data()tmpString = Buffer.ReadStringIf tmpString = "Hello Server!" ThentmpStrin = tmpStringCall HandleD(tmpStrin)Call PlayerMsg(index, "Hello Client!", Yellow)ElseCall PlayerMsg(index, "What?", Yellow)End IfSet Buffer = NothingEnd Sub2)Sub HandleD(ByRef tmpStrin As String)Dim Buffer As clsBuffer 'Set Buffer = New clsBufferBuffer.WriteLong SSendHelloServerBuffer.WriteString tmpStrinSendData Buffer.ToArray() "Errors are here"Set Buffer = Nothing ' Close the bufferEnd SubI ordered on the client:0)SSendHelloServer1)HandleDataSub (SSendHelloServer) = GetAddress (AddressOf HandleHelloServer)2)Sub HandleHelloServer (ByVal index As Long, ByRef Data () As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long) Dim Buffer As clsBuffer Dim tmpString As String Dim tmpStrin As String Set Buffer = New clsBuffer Buffer.WriteBytes Data () tmpString = Buffer.ReadString If tmpString = "Hello Server!" Then frmMain.Command1.Caption = "Hello Server!" End If Set Buffer = Nothing End SubI can not understand what the error (Moderators podpravte as it should but I do not know how) Link to comment Share on other sites More sharing options...
23.kraft Posted February 21, 2011 Author Share Posted February 21, 2011 @SamuGames:> This is a loaded question; it's hard to dig right in and ask how packets are sent back and forth.> > Robin created a very nice custom class which gets used as a buffer when sending packets. Whenever you're sending data in either direction, you first declare your new buffer as a clsBuffer, then you give it a long variable which defines how the client or server will read the packet and handle it.> > Example, let's make a button on frmMain, and send the words 'Hello Server!' to the server and have the server sent a message back to the client!> > 1\. Create a button on frmMain, call it cmdHello, give it the following backend code> ```> dim buffer as clsBuffer 'Setting up the buffer> dim tmpString as String 'tmpString which will hold the 'Hello Server!> > tmpString = "Hello Server!" 'See, we now have a string variable defined that we will send..dur...> > set buffer = new clsBuffer 'We're now setting it as a new buffer.> buffer.writeLong CSendHelloServer 'This CSendHelloServer is what gets sent 'first and will let the server know what command has been sent> buffer.writeString tmpString 'We're writing the tmpString (Hello Server) to the buffer> SendData buffer.toarray() 'We've actually sent the packet> set buffer = nothing ' Close the buffer> > ```> Step 2\. Now, if you noticed, we IDed that packet as CSendHelloServer, we put C first because it's coming from the client. The server won't know what CSendHelloServer means unless we declare it first. Inside the SERVER and the CLIENT in modEnumerations, where it defines all the client packets add.> ```> CSendHelloServer> > ```> Step 3. Now we need to make the SERVER handle the data that is being sent. If you look in modHandleData, the initMessages function. What we are going to do is add a new Handler for CSendHelloServer, so add this to the bottom of InitMessages. If you look, we're bascially looking at the packet, noticing it's identified as CSendHelloServer and we're calling the HandleHelloServer Sub!> ```> HandleDataSub(CSendHelloServer) = GetAddress(AddressOf HandleHelloServer) > > ```> Step 4\. We're now going to add the HandleHelloServer sub, add the following new Sub to the bottom of modHandleData on the Server.> ```> Sub HandleGetLoot(ByVal index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)> Dim buffer As clsBuffer 'Declaring the buffer> Dim tmpString As Long 'Declaring the tmpString that will handle the data we sent> > Set buffer = New clsBuffer 'Setup the buffer> buffer.WriteBytes Data() 'Write everything!> > tmpString = buffer.ReadString 'Read the String that we wrote> > if tmpString = "Hello Server!" then 'If our Message was Hello Server, say Hi back!> Call PlayerMsg(index, "Hello Client!", Yellow)> else 'If our message wasn't Hello Server, make it say What?> Call PlayerMsg(index, "What?", Yellow)> end if> Set buffer = Nothing 'Clear the buffer> End Sub> > ```> Hope this helps explain the traffic process a bit easiertried the same thing again on the server by setting a button on the server. gives tighter error "" SendData Buffer.ToArray () "(wrote that the Sub or Function not defined)I ordered on the server:0)SSendHelloServer1)Private Sub cmdHello_Click ()Dim buffer As clsBuffer Dim tmpString As String tmpString = "Hello Server!" Set buffer = New clsBuffer buffer.WriteLong SSendHelloServer buffer.WriteString tmpString SendData buffer.ToArray () Set buffer = NothingEnd SubI ordered on the client:0)SSendHelloServer1)HandleDataSub (SSendHelloServer) = GetAddress (AddressOf HandleHelloServer)2)Sub HandleHelloServer (ByVal index As Long, ByRef Data () As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long) Dim buffer As clsBuffer Dim tmpString As String Set buffer = New clsBuffer buffer.WriteBytes Data () tmpString = buffer.ReadString If tmpString = "Hello Server!" Then frmMain.Command2.Visible = True End If Set buffer = Nothing End Subwho knows how to fix the problem? Link to comment Share on other sites More sharing options...
crzyone9584 Posted February 21, 2011 Share Posted February 21, 2011 Server side fix the following in``` SendData buffer.ToArray ()```should be``` SendDataTo index, buffer.ToArray ()``` Link to comment Share on other sites More sharing options...
23.kraft Posted February 21, 2011 Author Share Posted February 21, 2011 SendDataTo index, buffer.ToArray ()prescribed. an error"compile error variable not defined "and swears to "index" Link to comment Share on other sites More sharing options...
Rob Janes Posted February 21, 2011 Share Posted February 21, 2011 It shouldn't be sending data from the server, you didn't follow the tutorial properly. Link to comment Share on other sites More sharing options...
23.kraft Posted February 21, 2011 Author Share Posted February 21, 2011 how well I did everything exactly copied (the only thing I changed is prescribed:SSendHelloServer (because the packet goes to the client)instead ofCSendHelloServerandHandleDataSub (SSendHelloServer) = GetAddress (AddressOf HandleHelloServer)instead ofHandleDataSub (áSendHelloServer) = GetAddress (AddressOf HandleHelloServer) Link to comment Share on other sites More sharing options...
crzyone9584 Posted February 21, 2011 Share Posted February 21, 2011 once again server sidechange``` Call HandleD(tmpStrin)```to``` Call HandleD(index, tmpStrin)```then change```Sub HandleD(ByRef tmpStrin As String)```to```Sub HandleD(byval index as long, Byval tmpStrin As String)``` Link to comment Share on other sites More sharing options...
23.kraft Posted February 21, 2011 Author Share Posted February 21, 2011 now shows no errors)the server:0)SSendHelloServer1)Private Sub Command1_Click()Dim buffer As clsBufferDim tmpString As StringDim index As LongtmpString = "Hello Server!"Set buffer = New clsBufferbuffer.WriteLong SSendHelloServerbuffer.WriteString tmpStringSendDataTo index, buffer.ToArray()Set buffer = NothingEnd Subclient:0)SSendHelloServer1)HandleDataSub(SSendHelloServer) = GetAddress(AddressOf HandleHelloServer)2)Sub HandleHelloServer(ByVal index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)Dim buffer As clsBufferDim tmpString As StringSet buffer = New clsBufferbuffer.WriteBytes Data()tmpString = buffer.ReadStringIf tmpString = "Hello Server!" ThenfrmMain.Command1.Caption = 1End IfSet buffer = NothingEnd Suberror does not issue and why it does not work (Who knows the reason please help 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