Page 1 of 2 12 LastLast
Results 1 to 40 of 45

Thread: Lib private void socket.dataarrival(object sender[RESOLVED]

  1. #1

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

    Resolved Lib private void socket.dataarrival(object sender[RESOLVED]

    ok i'm working on trying to convert my project into C# all is going pretty good and i'm stuck at this one area...

    Code:
    // This is the .NET Code
     Private Sub Socket_DataArrival(ByVal eventSender As System.Object, ByVal eventArgs As AxMSWinsockLib.DMSWinsockControlEvents_DataArrivalEvent) Handles Socket.DataArrival
    
    //  I know about the "Handles Socket.DataArrival already i'll list that in here
    Code:
    // The C# Code....
    public Form1()
            {
                InitializeComponent();
    socket.dataarrival += new EventHandler(Socket_DataArrival);
    Now the problem i'm having is the AxMSWinsockLib.DMSWinsockControl_Events_DataArrivalEvent..I'm trying to convert that over into the C#..

    Code:
     private void socket.dataarrival(object sender,  // Then from here I just dont know what do put in here socket.dataarrival?? or AxMSWinsock??
    I have AxInterop.MSWinsockLib.dll,InteropMSWinsock.dll,AxWinsockArray.dll

    I'm kinda confused at this point...dont know if i'm understanding this correctly but i dont think i need to include the Ax or Interop into the Code since it is C#.NET...
    Last edited by Rattlerr; Feb 3rd, 2006 at 02:05 PM.

  2. #2
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Lib private void socket.dataarrival(object sender, blah blah)

    Is this 2003 or 2005?

    Have you tried using the VB.NET > C# Converter?


    http://www.developerfusion.co.uk/uti...btocsharp.aspx
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  3. #3

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

    Re: Lib private void socket.dataarrival(object sender, blah blah)

    Its VB6 Updated too 2005 using the Updater...Then i went threw and fixed the code....I'v tried the VB.NET to C# converter i get an error everytime when i go to covert it...

  4. #4
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Lib private void socket.dataarrival(object sender, blah blah)

    Its probably because its a second conversion now.

    Does it give an error message?
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  5. #5

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

    Re: Lib private void socket.dataarrival(object sender, blah blah)

    Code:
     private void Socket_DataArrival(object eventSender, AxMSWinsockLib.DMSWinsockControlEvents_DataArrivalEvent eventArgs)
    {
    That is what it converts it too....But It just lights up my Error List with a messload of them...

    All with Blue lines under it...

    Creates a real mess..

  6. #6

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

    Re: Lib private void socket.dataarrival(object sender, blah blah)

    Error message::

    Error 1 The type or namespace name 'Socket_DataArrival' does not exist in the namespace 'AxMSWinsockLib' (are you missing an assembly reference?) C:\Documents and Settings\jerry\My Documents\Visual Studio 2005\Projects\DemonBytes\DemonBytes\DemonBytes.cs 290 76 DemonBytes

    What causes this message is when you alter the following section::

    Code:
    private void socket.dataarrival(object sender,  When you put in AxMSWinsockLib Etc Etc
    produces the error above no matter which one you try to insert..

    In the Intellisence you get the Following in the dropdown box::

    AxWinsock, AxWinsockMultiCaster, DMSWinsockControlEvents_ConnectionRequestEvent/ConnectionRequestEventHandler/
    DataArrivalEvent/DataArrivalEventHandler/ErrorEvent/ErrorEventHandler/SendProgressEvent/ AND SendProgressEventHandler...

  7. #7
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Lib private void socket.dataarrival(object sender, blah blah)

    'Socket_DataArrival' does not exist in the namespace 'AxMSWinsockLib' should be telling you that the event doesnt exist in the namespace. There is the DataArrivalEvent as you have shown. What if you chage it to that?
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  8. #8

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

    Re: Lib private void socket.dataarrival(object sender, blah blah)

    Code:
    private void  socket_dataarrival(object eventSender, AxMSWinsockLib.DMSWinsockControlEvents_DataArrivalEvent e)
            {
     short Index = socket.GetIndex(eventSender);
     Socket(Index).GetData(Buffer(Index));
     Debug.Print(Buffer(Index));
     if (Mid(Buffer[Index], 12, 1) == "W") 
       Sessionkey[Index] = Mid(Buffer[Index], 17, 4);
       ChallengeString[Index] = Mid(Buffer[Index], 30 + Len(YahooID[Index]), Len(Buffer[Index]) - 29);
       ChallengeString[Index] = Replace(ChallengeString[Index], "�13�1�", "");
       GetStrings(YahooID[Index], Password[Index], ChallengeString[Index], Crypt1[Index], Crypt2[Index], 1);
       socket[Index].SendData(Login(YahooID[Index], Crypt1[Index], Crypt2[Index], Sessionkey[Index]));
                  {
      else if (Mid(Buffer(Index), 12, 1) == "T") 
       toolStripStatusLabel1.Text = YahooID[Index] + "";
       socket[Index].Close();
                  }
      else if (Mid(Buffer[Index], 12, 1) == "U") 
       ListView1.Items[Index].ImageIndex = 0;
       Sessionkey[Index] = Mid(Buffer(Index), 17, 4);
       toolStripStatusLabel1.Text = System.Convert.ToString(System.Convert.ToDouble(toolStripStatusLabel1.Text) + 1);
       toolStripStatusLabel1.Text = "Status: " + YahooID[Index] + "";
     }
    Here is the Entire Block of code i'm working with thats becoming a pain

  9. #9
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Lib private void socket.dataarrival(object sender, blah blah)

    Where is the next error at? Remember that C# is case sensitive.

    I see that you have a debug.print in there. Should change it to this. Line 3

    Code:
    Console.WriteLine(Buffer(Index));
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  10. #10

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

    Re: Lib private void socket.dataarrival(object sender, blah blah)

    Error 3 Invalid expression term 'else' C:\Documents and Settings\jerry\My Documents\Visual Studio 2005\Projects\DemonBytes\DemonBytes\DemonBytes.cs 310 3 DemonBytes

    Is the Large Block of Code with all the Buffers and stuff is where i have the else if Errors

    Thats one spot..

    Code:
    private void Socket_Error(object eventSender, AxMSWinsockLib.DMSWinsockControlEvents_ErrorEvent eventArgs)
            {
                short Index = socket.GetType(eventSender);
                toolStripStatusLabel1.Text = "Status: Error";
                socket[Index].Close();
            }
    the socket.GetType(eventSender); i get a Blue Underline
    Orginal Code below I'm Converting to the Above Block

    Code:
    Private Sub Socket_Error(ByVal eventSender As System.Object, ByVal eventArgs As AxMSWinsockLib.DMSWinsockControlEvents_ErrorEvent) Handles Socket.Error
            Dim Index As Short = Socket.GetIndex(eventSender)
            StatusBar1.Items.Item(1).Text = "Status: Error"
            Socket(Index).Close()
        End Sub
    Last edited by Rattlerr; Feb 2nd, 2006 at 09:49 PM.

  11. #11
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Lib private void socket.dataarrival(object sender, blah blah)

    Why is one event an Error event and the other a ConnectEvent?
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  12. #12

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

    Re: Lib private void socket.dataarrival(object sender, blah blah)

    One is to have the App show an Error in an Event that if the Socket Dosnt Connect..

  13. #13
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Lib private void socket.dataarrival(object sender, blah blah)

    But it looks like your trying to convert one type of event procedure to a different type. You cant do that without rewritting it completely. The conversion utility is for converting or translating one event in one language to the same event but in another language.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  14. #14

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

    Re: Lib private void socket.dataarrival(object sender, blah blah)

    lol my mistake wrong block of code..handling 2 things at once here..hold on

  15. #15
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Lib private void socket.dataarrival(object sender, blah blah)

    No prob. I am tired but I didnt think I was loosing it this early in the evening.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  16. #16

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

    Re: Lib private void socket.dataarrival(object sender, blah blah)

    Their I fixed that problem I edited the Previous code above...

    To the right blocks...

    The Else If in the Large Block Of code the private void socket.dataarrival
    is where i get the error

    Error 3 Invalid expression term 'else' C:\Documents and Settings\jerry\My Documents\Visual Studio 2005\Projects\DemonBytes\DemonBytes\DemonBytes.cs 310 3 DemonBytes

  17. #17

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

    Re: Lib private void socket.dataarrival(object sender, blah blah)

    Updated Code

    Code:
     private void socket_connectevent(object sender, EventArgs e)
            {
                short index = socket.GetType(sender, eventArgs);
                socket[index].Send(System.Data(YahooID[index]));
            }
            private void Socket_DataArrival(object eventSender, Socket EventArgs)
            {
                short Index = socket[i](eventSender);
                Socket(Index).GetData(Buffer(Index));
                Console.WriteLine(Buffer(Index));
                if (Mid(Buffer(Index), 12, 1) == "W")
                {
                    Sessionkey(Index) = Mid(Buffer(Index), 17, 4);
                    ChallengeString(Index) = Mid(Buffer(Index), 30 + Len(YahooID(Index)), Len(Buffer(Index)) - 29);
                    ChallengeString(Index) = Replace(ChallengeString(Index), "�13�1�", "");
                    GetStrings(YahooID(Index), Password(Index), ChallengeString(Index), Crypt1(Index), Crypt2(Index), 1);
                    Socket(Index).SendData(Login(YahooID(Index), Crypt1(Index), Crypt2(Index), Sessionkey(Index)));
                }
                else if (Mid(Buffer(Index), 12, 1) == "T")
                {
                    toolStripStatusLabel1.Text = YahooID(Index) + "";
                    socket[i].Close();
                
                else  (Mid(Buffer(Index), 12, 1) == "U");
                    {
                    ListView1.Items[i].ImageIndex = 0;
                    Sessionkey(Index) = Mid(Buffer(Index), 17, 4);
                    toolStripStatusLabel1.Text = System.Convert.ToString(System.Convert.ToDouble(toolStripStatusLabel1.Text) + 1);
                    toolStripStatusLabel1.Text = "Status: " + YahooID(Index) + "";
                }
            }
    Error 1 Invalid expression term 'else' C:\Documents and Settings\jerry\My Documents\Visual Studio 2005\Projects\DemonBytes\DemonBytes\DemonBytes.cs 311 13 DemonBytes

    Error 2 The name 'eventArgs' does not exist in the current context C:\Documents and Settings\jerry\My Documents\Visual Studio 2005\Projects\DemonBytes\DemonBytes\DemonBytes.cs 290 50 DemonBytes

    Error 3 'System.Data' is a 'namespace', which is not valid in the given context C:\Documents and Settings\jerry\My Documents\Visual Studio 2005\Projects\DemonBytes\DemonBytes\DemonBytes.cs 291 39 DemonBytes

    Only things left To fix as far as i know...

  18. #18
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Lib private void socket.dataarrival(object sender, blah blah)

    Ok, I think your if else block should go like this (no else if's).
    Code:
    if 1 = 1
        if 2 = 2
            {
                Messagebox.Show("Test");
            }
        else
            {
                Messagebox.Show("Test");
            }
    else
        if 3 = 3 
            {
                Messagebox.Show("Test");
            }
        else
            {
                Messagebox.Show("Test");
            }
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  19. #19

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

    Re: Lib private void socket.dataarrival(object sender, blah blah)

    Updated a Block above your Post...

  20. #20
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Lib private void socket.dataarrival(object sender, blah blah)

    Error #2 -
    System.EventArgs e

    Error #3 -
    System.Data. ??? /// (YahooID[index]) This is not a member of the Data class. Use the intellisense and you will see it doesnt exist.

    Error #1 -
    else (Mid(Buffer(Index), 12, 1) == "U");
    Should be ...
    else if (Mid(Buffer(Index), 12, 1) == "U");
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  21. #21

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

    Re: Lib private void socket.dataarrival(object sender, blah blah)

    I cant sort all of it..I fix one thing and i get another problem....I'm just lost ..

  22. #22
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Lib private void socket.dataarrival(object sender, blah blah)

    Are you rebuilding the project to refresh it? What error is left?
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  23. #23

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

    Re: Lib private void socket.dataarrival(object sender, blah blah)

    99% of all of the errors are in the Large Block of Code...I cant sort them Alot of them are Blue Squily underlines..

    Which i generated Method Stubs but didnt help....Any way i can send you what i'm working so you can see whats going on...and if you do please comment it so i can learn from it..

  24. #24
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Lib private void socket.dataarrival(object sender, blah blah)

    Sorry for not being fluent enough in C# yet to solve this quicker.

    I am going to take a break for a bit and watch some tv with the family. be back in ~ an hour.

    I'll stop by to see if anyone else have chimmed in to assist.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  25. #25

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

    Re: Lib private void socket.dataarrival(object sender, blah blah)

    Thxs Appreciate the help Rob..

  26. #26
    Super Moderator Wokawidget's Avatar
    Join Date
    Nov 2001
    Location
    Headingly Occupation: Classified
    Posts
    9,632

    Re: Lib private void socket.dataarrival(object sender, blah blah)

    Code:
    socket[index].Send(System.Data(YahooID[index]));
    That's incorrect as u know.
    System.Data is a namespace, ie:
    Code:
    System.Data.SQLClient.SQLConnection MyConn;
    What was this in VB6?

    As for the events of the socket...hmmm I have a winsock class written in VB.NET back home in England, but not here. The Socket class, System.Net.Sockets.Socket, doesn't use events, but instead runs in a seperate thread, which halts until data comes in. I would be assuming that c# would be similar.

    I'm not home for a while now...UNLESS Rob has my Badger Messenger.NET code, in which case, he can post my winsock class, that does raise events, and you can use that

    WOka

  27. #27
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Lib private void socket.dataarrival(object sender, blah blah)

    Found it! Bad RobDog *SLAP* Forgot I had it.

    You used an event and a delegate to create the DataArrived event similar to what we are trying to convert. Probably much easier to just write from scratch instead of converting this vb.net/vb6 code.


    I'll be back in a bit. See if I can trim it down into what we only need.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  28. #28

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

    Re: Lib private void socket.dataarrival(object sender, blah blah)

    I upgraded it from VB6 to VB8 ,I used the automatic upgrader but it had errors..So i went threw and fixed them...The App does Compile in VB8..But i'm upgrading it too C# because C# has alot more Functionality and room too expand into more Functionality with less code and more power..

    Updated Code

    Code:
    private void Socket_DataArrival(object eventSender, Socket EventArgs)
            {
                short i;
                short Index = socket[i](eventSender);
                Socket(Index).GetData(Buffer(Index));
                Console.WriteLine(Buffer(Index));
                if (Mid(Buffer(Index), 12, 1) == "W")
                {
                    Sessionkey(Index) = Mid(Buffer(Index), 17, 4);
                    ChallengeString(Index) = Mid(Buffer(Index), 30 + Len(YahooID[i]), Len(Buffer(Index)) - 29);
                    ChallengeString[i] = Replace(ChallengeString(Index), "�13�1�", "");
                    GetStrings(YahooID[i], Password(Index), ChallengeString(Index), Crypt1(Index), Crypt2(Index), 1);
                    Socket(Index).SendData(Login(YahooID[i], Crypt1(Index), Crypt2(Index), Sessionkey(Index)));
                }
                else if (Mid(Buffer(Index), 12, 1) == "T")
                {
                    toolStripStatusLabel1.Text = YahooID[i] + "";
                    socket[i].Close();
                }
                else if(Mid(Buffer(Index), 12, 1) == "U")
                {
                    listView1.Items[i].ImageIndex = 0;
                    Sessionkey(i) = Mid(Buffer(Index), 17, 4);
                    toolStripStatusLabel1.Text = System.Convert.ToString(System.Convert.ToDouble(toolStripStatusLabel1.Text) + 1);
                    toolStripStatusLabel1.Text = "Status: " + YahooID[i] + "";
                }
            }
    I'v narrowed some stuff down..

    socket[i]
    .GetData
    Sessionkey(Index)
    ChallengeString(Index)
    Password(Index)

    The Above has Blue Siggly lines under them..

  29. #29
    Super Moderator Wokawidget's Avatar
    Join Date
    Nov 2001
    Location
    Headingly Occupation: Classified
    Posts
    9,632

    Re: Lib private void socket.dataarrival(object sender, blah blah)

    Rob, can you email me my Badger Messenger.NET code. I'll do a conversion.
    Send it to me via MSN or to my MSN email.

    Need more info that "squiggly line"

    Can u zip up ya project and post it here. I'll take a peek at it.

    Woka

  30. #30

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

    Re: Lib private void socket.dataarrival(object sender, blah blah)

    sure not a problem ....

    Now Penagate has been helping me out alot on msn messenger when he's on..So i know most of the code is correct above that Block....

    This has been my Pet project for quit a while to help solve a bigger problem Yahoo has over all...Have too know the Beast to Slay the Beast...

    Only thing close to solving the problem on Yahoo is either they go Encrypted packets ,so when their viewed they become Invalid and dropped...

    Or people like myself are working on a App to include "Packet Filtering" to drop modded packets..
    Last edited by Rattlerr; Feb 3rd, 2006 at 12:41 AM.

  31. #31
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Lib private void socket.dataarrival(object sender, blah blah)

    Woka, I sent you the latest version I have of Badger Messenger.NET.

    Thanks again for your help with this.

    Meow!
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  32. #32

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

    Re: Lib private void socket.dataarrival(object sender, blah blah)

    Yep all the help with this problem is appreciated...Thxs

  33. #33
    Super Moderator Wokawidget's Avatar
    Join Date
    Nov 2001
    Location
    Headingly Occupation: Classified
    Posts
    9,632

    Re: Lib private void socket.dataarrival(object sender, blah blah)

    Ok. Thanks to rob for sending my own code,m but here's a winsock class I wrote. I would use this in replace of what you have now. This uses .NET scokets.

    VB.NET code:
    Code:
    Imports System.Net.Sockets
    Imports System.IO
    Imports System.Text
    
    Public Class TCPConnection
    
        Public Event DataArrived(ByVal Data() As Byte)
        Public Event Disconnected()
    
        Private Const READ_BUFFER_SIZE As Integer = 255
    
        Private _ReadCallBack As AsyncCallback
    
        Private _HostAddress As String
        Private _Port As Integer
    
        Private _TCPClient As TcpClient
    
        Private _NS As NetworkStream
        Private _SW As StreamWriter
    
        Private _Buffer(READ_BUFFER_SIZE - 1) As Byte
    
        Private Delegate Sub RaiseReceiveEvent(ByVal Data() As Byte)
        Private _SyncObject As System.ComponentModel.ISynchronizeInvoke
    
        Public Sub New(ByRef SyncObject As System.ComponentModel.ISynchronizeInvoke, ByVal HostAddress As String, ByVal Port As Integer)
            _SyncObject = SyncObject
            _HostAddress = HostAddress
            _Port = Port
            Connect()
        End Sub
    
        Public ReadOnly Property HostAddress() As String
            Get
                Return _HostAddress
            End Get
        End Property
    
        Public ReadOnly Property Port() As Integer
            Get
                Return _Port
            End Get
        End Property
    
        Public Sub Connect()
            _TCPClient = New TcpClient(_HostAddress, _Port)
            _NS = _TCPClient.GetStream()
            _SW = New StreamWriter(_NS, Encoding.ASCII)
            _SW.AutoFlush = True
            StartAsyncRead()
        End Sub
    
        Public Sub Disconnect()
            If Not (_TCPClient Is Nothing) Then
                _TCPClient.Close()
                _TCPClient = Nothing
            End If
            RaiseEvent Disconnected()
        End Sub
    
        Public Sub SendData(ByRef Data As String)
            _SW.Write(Data)
        End Sub
    
        Private Sub StartAsyncRead()
            _ReadCallBack = New AsyncCallback(AddressOf DoRead)
            _NS.BeginRead(_Buffer, 0, READ_BUFFER_SIZE, _ReadCallBack, Nothing)
        End Sub
    
        Private Sub DoRead(ByVal Result As IAsyncResult)
            Try
                Dim BytesRead As Integer = _NS.EndRead(Result)
    
                If BytesRead < 1 Then
                    Disconnect()
                Else
                    Dim Data(BytesRead - 1) As Byte
                    _Buffer.Copy(_Buffer, 0, Data, 0, BytesRead)
    
                    Dim Args(0) As Object
                    Args(0) = Data
    
                    Dim NewDelegate As New RaiseReceiveEvent(AddressOf OnReceive)
                    _SyncObject.Invoke(NewDelegate, Args)
    
                    StartAsyncRead()
                End If
            Catch Ex As Exception
                Disconnect()
            End Try
        End Sub
    
        Private Sub OnReceive(ByVal Data() As Byte)
            RaiseEvent DataArrived(Data)
        End Sub
    End Class
    Now, this would be used like:
    Code:
    Private WithEvents _TCPConn As TCPConnection
    
        Private Function Connect(ByVal HostName As String, ByVal Port As Integer) As Boolean
            _TCPConn = New TCPLibrary.TCPConnection(Me, HostName, Port)
        End Function
    
        Private Sub _TCPConn_DataArrived(ByVal Data() As Byte) Handles _TCPConn.DataArrived
            Dim DataString As String = System.Text.Encoding.ASCII.GetString(Data, 0, Data.GetLength(0))
            'Console.WriteLine(String.Empty)
            'Console.WriteLine(DataString)
            'Console.WriteLine(String.Empty)
            DataArrived(DataString)
        End Sub
    You pass me (the form) to the syncobject, this is so when the data returns itt knows which thread to link it to.

    Woka

  34. #34
    Super Moderator Wokawidget's Avatar
    Join Date
    Nov 2001
    Location
    Headingly Occupation: Classified
    Posts
    9,632

    Re: Lib private void socket.dataarrival(object sender, blah blah)

    Now this TCPConnection class in C#, would look like:
    Code:
    using System.Net.Sockets; 
    using System.IO; 
    using System.Text; 
    public class TCPConnection 
    { 
     public event DataArrivedEventHandler DataArrived; 
     public event DisconnectedEventHandler Disconnected; 
     private const int READ_BUFFER_SIZE = 255; 
     private AsyncCallback _ReadCallBack; 
     private string _HostAddress; 
     private int _Port; 
     private TcpClient _TCPClient; 
     private NetworkStream _NS; 
     private StreamWriter _SW; 
     private byte[] _Buffer = new byte[READ_BUFFER_SIZE - 1]; 
     private delegate void RaiseReceiveEvent(byte[] Data); 
     private System.ComponentModel.ISynchronizeInvoke _SyncObject; 
    
     public TCPConnection(ref System.ComponentModel.ISynchronizeInvoke SyncObject, string HostAddress, int Port) 
     { 
       _SyncObject = SyncObject; 
       _HostAddress = HostAddress; 
       _Port = Port; 
       Connect(); 
     } 
    
     public string HostAddress { 
       get { 
         return _HostAddress; 
       } 
     } 
    
     public int Port { 
       get { 
         return _Port; 
       } 
     } 
    
     public void Connect() 
     { 
       _TCPClient = new TcpClient(_HostAddress, _Port); 
       _NS = _TCPClient.GetStream(); 
       _SW = new StreamWriter(_NS, Encoding.ASCII); 
       _SW.AutoFlush = true; 
       StartAsyncRead(); 
     } 
    
     public void Disconnect() 
     { 
       if (!((_TCPClient == null))) { 
         _TCPClient.Close(); 
         _TCPClient = null; 
       } 
       if (Disconnected != null) { 
         Disconnected(); 
       } 
     } 
    
     public void SendData(ref string Data) 
     { 
       _SW.Write(Data); 
     } 
    
     private void StartAsyncRead() 
     { 
       _ReadCallBack = new AsyncCallback(/* might be wrong, please check */ new EventHandler(DoRead)); 
       _NS.BeginRead(_Buffer, 0, READ_BUFFER_SIZE, _ReadCallBack, null); 
     } 
    
     private void DoRead(IAsyncResult Result) 
     { 
       try { 
         int BytesRead = _NS.EndRead(Result); 
         if (BytesRead < 1) { 
           Disconnect(); 
         } else { 
           byte[] Data = new byte[BytesRead - 1]; 
           _Buffer.Copy(_Buffer, 0, Data, 0, BytesRead); 
           object[] Args = new object[0]; 
           Args(0) = Data; 
           RaiseReceiveEvent NewDelegate = new RaiseReceiveEvent(/* might be wrong, please check */ new EventHandler(OnReceive)); 
           _SyncObject.Invoke(NewDelegate, Args); 
           StartAsyncRead(); 
         } 
       } catch (Exception Ex) { 
         Disconnect(); 
       } 
     } 
    
     private void OnReceive(byte[] Data) 
     { 
       if (DataArrived != null) { 
         DataArrived(Data); 
       } 
     } 
    }
    and then to use it, it would be something like:
    Code:
    private TCPConnection _TCPConn; 
    
    private bool Connect(string HostName, int Port) 
    { 
     _TCPConn = new TCPLibrary.TCPConnection(this, HostName, Port); 
    } 
    
    private void _TCPConn_DataArrived(byte[] Data) 
    { 
     string DataString = System.Text.Encoding.ASCII.GetString(Data, 0, Data.GetLength(0)); 
     DataArrived(DataString); 
    }
    Hoep this helps.

    Damn svrs back up now. Back to grind stone

    Wooooof

  35. #35
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Lib private void socket.dataarrival(object sender, blah blah)

    So, is this resolved?

  36. #36
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Lib private void socket.dataarrival(object sender, blah blah)

    Probably "Pending" I would say as woka just posted the solution but rattler needs to integrate the code into his app. So there might be some assistance needed there?
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  37. #37

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

    Re: Lib private void socket.dataarrival(object sender, blah blah)

    Umm yeah Where does this code need to go?? lol

    I made the TCPConnection Class file..

    As for the 2nd part where does that intergrate in with the Socket_DataArrival Block??
    Last edited by Rattlerr; Feb 3rd, 2006 at 01:52 PM.

  38. #38

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

    Re: Lib private void socket.dataarrival(object sender[RESOLVED]

    Thxs alot Rob and WokaWidget for all the help Greatly Appreicated As far as it looks so far your code Woka solved the issues at hand..

    This part is Resolved ...Gj

    Until next time...lol

  39. #39

  40. #40

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

    Re: Lib private void socket.dataarrival(object sender[RESOLVED]

    yeah it all Works fine np's ..

    Code:
    using System.Net.Sockets; 
    using System.IO; 
    using System.Text; 
    public class TCPConnection
    I put that onto its On File used a Codefile.cs which comes Blank named it TCPConnection..Works good..

    The Second Block of your Code:

    Code:
    private TCPConnection _TCPConn; 
    
    private bool Connect(string HostName, int Port) 
    { 
     _TCPConn = new TCPLibrary.TCPConnection(this, HostName, Port); 
    } 
    
    private void _TCPConn_DataArrived(byte[] Data) 
    { 
     string DataString = System.Text.Encoding.ASCII.GetString(Data, 0, Data.GetLength(0)); 
     DataArrived(DataString); 
    }
    I never put into my program....With the Class you made the Intellsence Shows a TCPConnection avaible in the Box...So I Select the TCPConnection and it highlights in the Aqua Blue Color ,Run the Debugger and Build Np's at all..
    Last edited by Rattlerr; Feb 4th, 2006 at 02:33 AM.

Page 1 of 2 12 LastLast

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