Results 1 to 1 of 1

Thread: [2.0] Socket DataArrival

Threaded View

  1. #1

    Thread Starter
    Hyperactive Member Rattlerr's Avatar
    Join Date
    Jul 2005
    Location
    FloralCity,Florida
    Posts
    269

    Question [2.0] Socket DataArrival

    Here is a small section i'm working on that i just cant seem to figure out...

    Now dont have a Stroke here just because i have the VB.NET Code posted..Just showing the section of Code i'm translating to C#..

    VB Code:
    1. Private Sub Socket_DataArrival(ByVal eventSender As System.Object, ByVal eventArgs As AxMSWinsockLib.DMSWinsockControlEvents_DataArrivalEvent) Handles Socket.DataArrival
    2.         Dim Index As Short = Socket.GetIndex(eventSender)
    3.         Socket(Index).GetData(Buffer(Index))
    4.         Debug.Print(Buffer(Index))
    5.         If Mid(Buffer(Index), 12, 1) = "W" Then
    6.             Sessionkey(Index) = Mid(Buffer(Index), 17, 4)
    7.             ChallengeString(Index) = Mid(Buffer(Index), 30 + Len(ClientID(Index)), Len(Buffer(Index)) - 29)
    8.             ChallengeString(Index) = Replace(ChallengeString(Index), "�13�1�", "")
    9.             Call GetStrings(ClientID(Index), Password(Index), ChallengeString(Index), Crypt1(Index), Crypt2(Index), 1)
    10.             Socket(Index).SendData(Login(ClientID(Index), Crypt1(Index), Crypt2(Index), Sessionkey(Index)))
    11.         ElseIf Mid(Buffer(Index), 12, 1) = "T" Then
    12.             statz.Items.Item(1).Text = ClientID(Index) & ""
    13.             Socket(Index).Close()
    14.         ElseIf Mid(Buffer(Index), 12, 1) = "U" Then
    15.             ListView1.Items.Item(Index).SubItems.Add(1)
    16.             Sessionkey(Index) = Mid(Buffer(Index), 17, 4)
    17.             statz.Items.Item(2).Text = CStr(CDbl(statz.Items.Item(2).Text) + 1)
    18.             statz.Items.Item(1).Text = "Status: " & ClientID(Index) & ""
    19.         End If
    20.     End Sub

    Here is the Section of C# that i have done so far,that only produces a few errors,but i'm sure i'v messed up some where's along the line..

    VB Code:
    1. private void Socket_DataArrival(object sender, EventArgs e)
    2.         {
    3.             short index;
    4.             newsock.Receive(buffer, 0, SocketFlags.None);
    5.             if (String.Format(LoginMod.LoginMod.Buffer[index], 12, 1) == "W")
    6.             LoginMod.LoginMod.SessionKey[index] = String.Format("{17}, {4}", LoginMod.LoginMod.Buffer[index]);
    7.             LoginMod.LoginMod.ChallengeString[index] = String.Format("{30},{4}", LoginMod.LoginMod.Buffer[index],
    8.                                       Convert.ToChar(LoginMod.LoginMod.ClientID[index]),
    9.                                       Convert.ToChar(Convert.ToByte(LoginMod.LoginMod.Buffer[index]) - 29));
    10.             LoginMod.LoginMod.ChallengeString[index] = String.Format(LoginMod.LoginMod.ChallengeString[index], "�13�1�", "");
    11.             LoginMod.LoginMod.GetStrings(ref ClientID, ref Password, ref Seed, ref Str1, ref Str2, ref mode);
    12.             string YahooID = LoginMod.LoginMod.ClientID[index];
    13.             string Password = LoginMod.LoginMod.Password[index];
    14.             string ChallengeString = LoginMod.LoginMod.ChallengeString[index];
    15.             string Crypt1 = LoginMod.LoginMod.Crypt1[index];
    16.             string Crypt2 = LoginMod.LoginMod.Crypt2[index];
    17.             int mode = 1;
    18. }

    The only section that is producing errors is the LoginMod.LoginMod.GetStrings where the "ref Seed, ref Str1, ref Str2, & ref mode" Now what i think is just weird is that they Exist in the LoginMod.cs under the " public static bool GetStrings( ) "..But they dont show up in the intelli-sence like ClientID and Password does..

    And yes i have Completed all the C# code compared to whats their in VB.NET,for me its fix them as i get them..Instead of trying to fix a boat load of stuff..
    Last edited by Rattlerr; Aug 10th, 2006 at 10:02 PM.

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