Hey!
I've been learning for some time (Visual Basic) now and decided to make a bot some weeks ago.
I know how to read and send packets and etc.
My problem: I don't seem to receive 0x50 back from B.net.
I receive 0x25 but not 0x50.
Maybe packets are merging together or something is wrong?
Help would be appreciated.
It's going to be difficult to help you out unless you atleast post what order you're sending your packets in.
Quote from: Warrior on September 24, 2006, 12:41 PM
It's going to be difficult to help you out unless you atleast post what order you're sending your packets in.
I've connected to BNLS.
Sent 0x0E to BNLS.
Received a response.
I connected to Bnet..sent 0x01.
I then sent 0x50.
I received 0x25.
That's where I'm stuck.
probably sending your 0x50 wrong then, showing the code would help us pinpoint the error.
Quote from: l2k-Shadow on September 24, 2006, 01:03 PM
probably sending your 0x50 wrong then, showing the code would help us pinpoint the error.
PacketBuf.InsertDWORD &H0
PacketBuf.InsertDWORD &H49583836 'IX86
PacketBuf.InsertDWORD &H53455850 'SEXP
PacketBuf.InsertDWORD &HCF 'Verbyte
PacketBuf.InsertDWORD &H0
PacketBuf.InsertDWORD &H0
PacketBuf.InsertDWORD &H0
PacketBuf.InsertDWORD &H0
PacketBuf.InsertDWORD &H0
PacketBuf.InsertNTString "CAN" 'Country Abbr.
PacketBuf.InsertNTString "Canada" 'Country Name
PacketBuf.SendPacket Winsock2, &H50
AddChat vbYellow, "Sent: 0x50"
PacketBuf is my Packet Buffer.
Winsock2 is your sck_BNET or sck_BNLS?
Quote from: Mystical on September 24, 2006, 02:00 PM
Winsock2 is your sck_BNET or sck_BNLS?
Winsock2 is my winsock to BNET.
maybe its in your packetbuffer.. :|
I used DarkMinion's packet buffer ???
that's one old packetbuffer.. :P I don't remember if hmm, i forgot.. stupid moment.
well your 0x50 looks correct, i think then that your error must be in your Winsock_DataArrival() sub. most likely not parsing clumped packets correctly.
How can he get a clumped packet so early on?
You may be right about his DataArrival parsing being wrong however.
Are you sending the protocol byte?
Quote from: Warrior on September 24, 2006, 02:53 PM
How can he get a clumped packet so early on?
You may be right about his DataArrival parsing being wrong however.
Well I sometimes get 0x25 and 0x50 clumped at the beginning, so it is a possibility. I don't think it's the protocol byte because then he wouldn't receive 0x25. So then it's either bad parsing or bad packet buffer.
Your best bet is that they ARE being clumped as Shadow said, Please post your dataarrival and a packet log to help us find the solution
Eh, I found that that was my Data_Arrival sub...
I got this(I found this sub on this forum):
Private Sub Winsock2_DataArrival(ByVal bytesTotal As Long)
Static PktBuff As String 'Packet Buffer
Dim Incoming As String
Dim PacketLength As Long
Winsock2.GetData Incoming, vbString, bytesTotal
PktBuff = PktBuff & Incoming
While Len(PktBuff) > 3
PacketLength = GetWord(Mid$(PktBuff, 3, 2))
If Len(PktBuff) < PacketLength Then Exit Sub
ParseData Left(PktBuff, PacketLength))
PktBuff = Mid(PktBuff, PacketLength + 1)
Wend
End Sub
When I run it, I get a type mismatch error... it highlights this line:
ParseData Left(PktBuff, PacketLength))
ParseData is another sub that takes my packets and, like the name explains, parse packets.
you have an extra ) at the end ::)
Quote from: l2k-Shadow on September 24, 2006, 05:38 PM
you have an extra ) at the end ::)
Sorry, I made a mistake in my post. It was supposed be:
ParseData (Left(PktBuff, PacketLength))
I still get the same error.
Then your ParseData is looking for something other than a string.
Here is my ParseData sub.
It was just a test to see if I received the packets correctly.
Public Sub ParseData(PacketID As Long)
'Parsing
Select Case PacketID
Case &H25
AddChat vbYellow, "Received: 0x25"
Case &H50
AddChat vbYellow, "Received: 0x50"
End Select
End Sub
Quote from: Abolition on September 24, 2006, 05:47 PM
Here is my ParseData sub.
It was just a test to see if I received the packets correctly.
Public Sub ParseData(PacketID As Long)
'Parsing
Select Case PacketID
Case &H25
AddChat vbYellow, "Received: 0x25"
Case &H50
AddChat vbYellow, "Received: 0x50"
End Select
End Sub
Exactly, your ParseData is expecting a
Long, but Left$() returns a
String.
Quote from: Abolition on September 24, 2006, 05:40 PM
Quote from: l2k-Shadow on September 24, 2006, 05:38 PM
you have an extra ) at the end ::)
Sorry, I made a mistake in my post. It was supposed be:
ParseData (Left(PktBuff, PacketLength))
I still get the same error.
Not exactly how I would do things but you can try
ParseData (Val#(Left$(PktBuff, PacketLength)))
But by the looks of this you arn't extracting the packet ID to begin with. So I have a feeling you are going to have a lot more problems in the future.
Dear God, just post a packet log.
Quote from: ImaWh0re on September 24, 2006, 07:29 PM
Quote from: Abolition on September 24, 2006, 05:40 PM
Quote from: l2k-Shadow on September 24, 2006, 05:38 PM
you have an extra ) at the end ::)
Sorry, I made a mistake in my post. It was supposed be:
ParseData (Left(PktBuff, PacketLength))
I still get the same error.
Not exactly how I would do things but you can try
ParseData (Val#(Left$(PktBuff, PacketLength)))
But by the looks of this you arn't extracting the packet ID to begin with. So I have a feeling you are going to have a lot more problems in the future.
Yes! Use Val#() on a string, excellent suggestion.
Click (http://www.amazon.com/Visual-Basic-6-Dummies-Windows/dp/0764503707/sr=8-2/qid=1159150390/ref=pd_bbs_2/102-4734669-2508922?ie=UTF8&s=books).
Quote from: Lord[nK] on September 24, 2006, 09:13 PM
Click (http://www.amazon.com/Visual-Basic-6-Dummies-Windows/dp/0764503707/sr=8-2/qid=1159150390/ref=pd_bbs_2/102-4734669-2508922?ie=UTF8&s=books).
I own a copy, I'll sell it for $15.
I have it too lol. Not useful anymore. Il sell for $10.
Quote from: l2k-Shadow on September 24, 2006, 08:47 PM
Quote from: ImaWh0re on September 24, 2006, 07:29 PM
Quote from: Abolition on September 24, 2006, 05:40 PM
Quote from: l2k-Shadow on September 24, 2006, 05:38 PM
you have an extra ) at the end ::)
Sorry, I made a mistake in my post. It was supposed be:
ParseData (Left(PktBuff, PacketLength))
I still get the same error.
Not exactly how I would do things but you can try
ParseData (Val#(Left$(PktBuff, PacketLength)))
But by the looks of this you arn't extracting the packet ID to begin with. So I have a feeling you are going to have a lot more problems in the future.
Yes! Use Val#() on a string, excellent suggestion.
Dear MORON,
Msgbox Val#("23")
Quote from: Abolition on September 24, 2006, 05:47 PM
Here is my ParseData sub.
It was just a test to see if I received the packets correctly.
Public Sub ParseData(PacketID As Long)
'Parsing
Select Case PacketID
Case &H25
AddChat vbYellow, "Received: 0x25"
Case &H50
AddChat vbYellow, "Received: 0x50"
End Select
End Sub
maybe somthing like?
Public Sub ParseData(Data as String)
Dim PacketID As Byte
PacketID = Asc(Mid(Data, 2, 1))
Select Case PacketID
Case &H25
Case &H50
Case &H51
End Select
End Sub
Quote from: ImaWh0re on September 24, 2006, 11:54 PM
Quote from: l2k-Shadow on September 24, 2006, 08:47 PM
Quote from: ImaWh0re on September 24, 2006, 07:29 PM
Quote from: Abolition on September 24, 2006, 05:40 PM
Quote from: l2k-Shadow on September 24, 2006, 05:38 PM
you have an extra ) at the end ::)
Sorry, I made a mistake in my post. It was supposed be:
ParseData (Left(PktBuff, PacketLength))
I still get the same error.
Not exactly how I would do things but you can try
ParseData (Val#(Left$(PktBuff, PacketLength)))
But by the looks of this you arn't extracting the packet ID to begin with. So I have a feeling you are going to have a lot more problems in the future.
Yes! Use Val#() on a string, excellent suggestion.
Dear MORON,
Msgbox Val#("23")
Yes, however, Left$(PktBuff, PacketLength) does not return a number.
Quote from: l2k-Shadow on September 25, 2006, 12:08 AM
Yes, however, Left$(PktBuff, PacketLength) does not return a number.
Msgbox Val#(Left$("23",2))
Better? Comprende?
Quote from: ImaWh0re on September 25, 2006, 12:16 AM
Quote from: l2k-Shadow on September 25, 2006, 12:08 AM
Yes, however, Left$(PktBuff, PacketLength) does not return a number.
Msgbox Val#(Left$("23",2))
Better? Comprende?
The point is, you're not supposed to do it. Val# returns a Double (which is a float, iirc), whereas it expects a Long.
Quote from: ImaWh0re on September 25, 2006, 12:16 AM
Quote from: l2k-Shadow on September 25, 2006, 12:08 AM
Yes, however, Left$(PktBuff, PacketLength) does not return a number.
Msgbox Val#(Left$("23",2))
Better? Comprende?
Val:
http://msdn2.microsoft.com/en-us/library/k7beh1x9.aspx
CLng:
http://msdn2.microsoft.com/en-us/library/ck4c5842.aspx
hrmm i wonder....
Quote from: topaz on September 25, 2006, 12:31 AM
Quote from: ImaWh0re on September 25, 2006, 12:16 AM
Quote from: l2k-Shadow on September 25, 2006, 12:08 AM
Yes, however, Left$(PktBuff, PacketLength) does not return a number.
Msgbox Val#(Left$("23",2))
Better? Comprende?
The point is, you're not supposed to do it. Val# returns a Double (which is a float, iirc), whereas it expects a Long.
That it does, I was just trying to state that it doesn't matter if you
do that to a string. As I said before the coding was whacked. By the way, I find it very funny how you people look this up before saying something, it's like its battle of the wits after googling information. I'm not flaming any person when I say that either, just saying.
Although yes it should of been common sense on my part. I was wrong, I don't have a problem admitting to that unlike a lot of people.
Quote from: ImaWh0re on September 25, 2006, 03:07 AM
That it does, I was just trying to state that it doesn't matter if you do that to a string. As I said before the coding was whacked. By the way, I find it very funny how you people look this up before saying something, it's like its battle of the wits after googling information. I'm not flaming any person when I say that either, just saying.
Of course, we don't like making up stuff.