Results 1 to 15 of 15

Thread: Socket_ConnectEvent Conversion[RESOLVED]

  1. #1

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

    Resolved Socket_ConnectEvent Conversion[RESOLVED]

    This is the line of code i need some help Converting..

    VB Code:
    1. Private Sub Socket_ConnectEvent(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs)

    Need that Converted I'v tried a Method but then i cant add the code that follows...

    Thxs for the Help in Advance..
    Last edited by Rattlerr; Jan 31st, 2006 at 05:55 PM.

  2. #2
    Fanatic Member
    Join Date
    May 2005
    Posts
    898

    Re: Socket_ConnectEvent Conversion

    Do you mean the Handles keyword in VB.NET?
    If so, it doesn't exist in C#, you should ad this to the constructor:
    Code:
    SocketThingy.ConnectEvent += new EventHandler(Socket_ConnectEvent)
    If not, please elaborate.
    "so just keep in mind that fantasy is not the same as realtiy and make sure u remember that wii sports may be fun but u cant count on it as exercise ok cool bye" - HungarianHuman

  3. #3
    Banned
    Join Date
    Nov 2005
    Posts
    2,367

    Re: Socket_ConnectEvent Conversion

    Slightly OT, butthis is a good reference for how to do the same things in both languages.

  4. #4

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

    Question Re: Socket_ConnectEvent Conversion

    I'v tried working this Socket a few ways here is the VB8 version::

    VB Code:
    1. Socket(Index).SendData(Data(ClientID(Index)))

    This is what i have so far that should work::

    VB Code:
    1. private Socket[]socket;
    2.           short index = socket.GetIndex(eventSender);
    3.           socket[].Send(Data, ClientID[])

    Only problem is under .Send "Class,struct or Interface must have a return type"
    Then the , gets me a Identifier Expected...

    any ideas??

  5. #5
    Banned
    Join Date
    Nov 2005
    Posts
    2,367

    Re: Socket_ConnectEvent Conversion

    Can you use [ CODE] tags for the time being? I think they're still working, that's really hard to read.

    It looks like you have an array of sockets you're attempting to ".Send". Is there a specific index you should be using? Maybe....

    Code:
    			System.Net.Sockets.Socket[] socket1;
    			short index = socket1.GetIndex(eventSender);
    			socket1[index].Send(Data, ClientID[0]);
    Nothing in the code specifies which ClientID you're using?
    And nothing in the code is populating your socket array?

  6. #6

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

    Re: Socket_ConnectEvent Conversion

    Quote Originally Posted by grilkip
    Do you mean the Handles keyword in VB.NET?
    If so, it doesn't exist in C#, you should ad this to the constructor:
    Code:
    SocketThingy.ConnectEvent += new EventHandler(Socket_ConnectEvent)
    If not, please elaborate.
    I have added that to the constructor..But still haveing one heck of a time with just these few lines of code....

  7. #7
    Fanatic Member
    Join Date
    May 2005
    Posts
    898

    Re: Socket_ConnectEvent Conversion

    Can you post the full function, because I haven't a clue as to what we are talking about currently.

    Could be me though.
    "so just keep in mind that fantasy is not the same as realtiy and make sure u remember that wii sports may be fun but u cant count on it as exercise ok cool bye" - HungarianHuman

  8. #8

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

    Question Re: Socket_ConnectEvent Conversion

    ok here is the Entire VB8 Section of code i'm working on

    Code:
    Private Sub Socket_ConnectEvent(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Socket.ConnectEvent
            Dim Index As Short = Socket.GetIndex(eventSender)
            Socket(Index).SendData(Data(ClientID(Index)))
        End Sub
    I have this in the Contstructor
    Code:
    Socket.ConnectEvent += new EventHandler(Socket_ConnectEvent)
    But i just cant seem to convert the above VB8 ...

    I tried your code sevenhalo but i still get compile errors on the [index] & ClientID..."Array size cannot be specified in a variable declaration(try intializing with a new expression) that is the error i receive...

    The .Send Error is :: class,struct,or interface must have a return type..

  9. #9
    Banned
    Join Date
    Nov 2005
    Posts
    2,367

    Re: Socket_ConnectEvent Conversion

    I knew the code wasn't going to work, that's why I added the questions about it underneath

    Can you post the code in it's entirety (with your declarations and all). I don't see a ConnectEvent anywhere in the Fx.

  10. #10

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

    Re: Socket_ConnectEvent Conversion

    Post #8

  11. #11
    Banned
    Join Date
    Nov 2005
    Posts
    2,367

    Re: Socket_ConnectEvent Conversion

    I saw that one, I mean it's ENTIRETY

    Spare no details, we can handle it.

    .o0(or is that all you have?)

  12. #12

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

    Re: Socket_ConnectEvent Conversion

    I'm always reluctant too put up an entire project..

  13. #13
    Fanatic Member
    Join Date
    May 2005
    Posts
    898

    Re: Socket_ConnectEvent Conversion[RESOLVED]

    Shoot, I was hoping to steal your 1337 code.

    7halo didn't mean the whole project, more like the class.
    "so just keep in mind that fantasy is not the same as realtiy and make sure u remember that wii sports may be fun but u cant count on it as exercise ok cool bye" - HungarianHuman

  14. #14
    Banned
    Join Date
    Nov 2005
    Posts
    2,367

    Re: Socket_ConnectEvent Conversion[RESOLVED]

    Understandable, but if we can't see all of the rellevant code (ecspecially when you're trying to convert an entire project to a new language where anything can be out of place); I don't know what else to ask... Sorry

  15. #15
    Fanatic Member
    Join Date
    May 2005
    Posts
    898

    Re: Socket_ConnectEvent Conversion[RESOLVED]

    Isn't it great when threads get resolved despite our best efforts? (rhetorical)
    "so just keep in mind that fantasy is not the same as realtiy and make sure u remember that wii sports may be fun but u cant count on it as exercise ok cool bye" - HungarianHuman

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