Results 1 to 6 of 6

Thread: [Winsock] Send a packet to a server

  1. #1

    Thread Starter
    Frenzied Member Inuyasha1782's Avatar
    Join Date
    May 2005
    Location
    California, USA
    Posts
    1,035

    [Winsock] Send a packet to a server

    Well, I really have no clue how to go about doing this. Anyways, I have a packet sniffer. What I want to do is get the packet that is sent out when you press the "play" button on a flash game. So after some sniffing, I found the right packet. Now I have the data saved, and I want to know how to send this packet through Vb? I already have a winsock control, and am connected to the website where the flash game is, now just need to actually send the packet. Is this possible?
    Age - 15 ::: Level - Advanced
    If you find my post useful please ::Rate It::


  2. #2
    Member
    Join Date
    Nov 2004
    Location
    California
    Posts
    46

    Re: [Winsock] Send a packet to a server

    well what id do is make the packet you have, make a function with it then just call on it like so

    VB Code:
    1. If Winsock.State = 7 Then  Winsock.SendData (FunctionName Here)

    thats pretty much it

  3. #3

    Thread Starter
    Frenzied Member Inuyasha1782's Avatar
    Join Date
    May 2005
    Location
    California, USA
    Posts
    1,035

    Re: [Winsock] Send a packet to a server

    So basicly I am just sending the text of the packet?
    Age - 15 ::: Level - Advanced
    If you find my post useful please ::Rate It::


  4. #4
    Member
    Join Date
    Nov 2004
    Location
    California
    Posts
    46

    Re: [Winsock] Send a packet to a server

    yeah like when yah send the stuff you want to send you could do something like

    VB Code:
    1. If Not SockChat.State = sckClosed Then SockChat.SendData TxtGeneral(2).Text
    TxtGeneral(2).Text is the text you would be sending here in this case
    then you would need to set up a data arival so when yah send the text you will get have to recieve as well
    as for me i prewrite handles in mods makes my form code look clean and using handles to me is the way i would go and in your data arrival you just call on the handle and it takes care of all your stuff for you
    example
    VB Code:
    1. ' data arrival in your form would be like this
    2.  
    3.  
    4. Private Sub SockChat_DataArrival(ByVal bytesTotal&)
    5. Dim Data$
    6. SockChat.GetData Data
    7. Debug.Print Data
    8.   Call Handle (Data, SockChat)
    9. End Sub
    10.  
    11. 'example of what a handle looks like if ah dont know
    12.  
    13. Public Sub ChatHandle(Data$, YahooYcht As Winsock)
    14. 'handles the data
    15. Select Case Mid(Data, 12, 1)
    16.   Case Chr(&H1)
    17.     With FrmMain
    18.       .CmdGeneral(0).Caption = "Logout"
    19.       .StatusBar.SimpleText = "Logined In..Ready to join chat.."
    20.     End With
    21.   Case Chr(&H11)
    22.     If InStr(1, Data, "vcauth=") > 0 And InStr(1, Data, "rmspace=") > 0 Then
    23.     If Mid(Data, 17, 11) = "Join Failed" And Mid(Split(Data, "À€")(3), 1, 11) = "/c/ad.html?" Then
    24.       ChatRoom = Split(Data, "À€")(1)
    25.     Else
    26.       ChatRoom = Mid(Data, 17, Len(Data) - 16)
    27.       ChatRoom = Split(ChatRoom, "À€")(0)
    28.     End If
    29.       VoiceToken = Split(Data, "vcauth=")(1)
    30.       VoiceToken = Split(VoiceToken, "&" & Chr(&H2E))(0)
    31.       RoomSpace = Split(Data, "rmspace=")(1)
    32.       RoomSpace = Split(RoomSpace, "À€")(0)
    33.      End If
    34.   Case Chr(&H2)  
    35.     With FrmMain
    36.       .SockAuth.Close
    37.       YahooYcht.Close
    38.       .CmdGeneral(0).Caption = "Login"
    39.     End With
    40. End Select
    41. End Sub

    well i hope this kinda helps you out maybe if you have a source post it and ill have a look at it for yah and maybe comment in it and explain it better

  5. #5
    Fanatic Member neicedover1982's Avatar
    Join Date
    Jun 2005
    Posts
    566

    Re: [Winsock] Send a packet to a server

    Hello

    I got my server and client talking to each other using winsock. Right now I am sending 1 word back and forth. The client says "Hi", the server replies with "Greetings". Simple stuff like that so I can get it working correctly.

    I am using this for my game, i have a central server everyone connects to to get information. There is not constant contact between the two. Just a signal going back and forth every couple of minutes to update and give status of things.

    My question is how much data can be sent in a single "Socket(Index).SendData strOutData" command? How much data can I put in the strOutData variable?

    I have planned on sending keywords and such "username,buy,computer,units" from the client to the server and the server returns roughly the same. The server needs to send out more though, somtimes I need it to send out about 20 things to each player when they ask for it. How much text and integers can i put in that variable before it takes to long for winsock? Thank you.
    Kevin | New England Iced Over | http://www.kevincawleyjr.com

  6. #6
    Member
    Join Date
    Nov 2004
    Location
    California
    Posts
    46

    Re: [Winsock] Send a packet to a server

    well you say you have one word try putting the text you like to be sending to poeple in there and see if work or not i wish i could be more helpful and tell yah but i my self dont know exactly how much but trial and error is what helps me figure out what i can do and what i cant give it a shot and see what happens

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width