Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Optional data sending


Notsu
 Share

Recommended Posts

CLIENT:

```

Sub SendSomething(ByVal LongValue As Long, ByVal StringValue As String)

Dim Buffer As clsBuffer

Set Buffer = New clsBuffer

Buffer.WriteLong CGuildCommand

Buffer.WriteLong LongValue

If StringValue <> vbNullString Then

Buffer.WriteString StringValue

End If

SendData Buffer.ToArray()

Set Buffer = Nothing

End Sub

```

SERVER:

```

Sub HandleSomething(ByVal index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)

Dim buffer As clsBuffer

Dim LongValue As Long, StringValue As String

Set buffer = New clsBuffer

buffer.WriteBytes Data()

LongValue = buffer.ReadLong

StringValue = buffer.ReadString

Set buffer = Nothing

End Sub

```

Is it worth? Is it optimal and done in proper way? I'm saying about lines where is check: if StringValue is not empty then send it.

But the server will try to read string if it's not sent in client code.

I hope you'll understand. ![:D](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/biggrin.png)

Thanks for reply.
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...