socket programming

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • bhargavi

    #1

    socket programming

    hi i am doing socket programming. how do i access the
    value of a variable in one class in another class?
    is it possible to copy a socket descriptor of one class
    to a socket descriptor of another class? if so how to do
    it?

    please reply soon. any help is appreciated
  • lallous

    #2
    Re: socket programming

    "bhargavi" <anonymous@disc ussions.microso ft.com> wrote in message
    news:069501c3bb c6$b9fb51c0$a30 1280a@phx.gbl.. .[color=blue]
    > hi i am doing socket programming. how do i access the
    > value of a variable in one class in another class?[/color]
    Yes, either make 'friend' method if the variables are private or simply to
    member to member assignment if members are public.
    [color=blue]
    > is it possible to copy a socket descriptor of one class
    > to a socket descriptor of another class? if so how to do
    > it?[/color]
    'sd' is just a handle, you can copy it from a class to another.
    However if you're copying from a process to another try duplicating the 'sd'
    instead of copying it.

    HTH
    Elias


    Comment

    • Gerhard Menzl

      #3
      Re: socket programming

      bhargavi wrote:
      [color=blue]
      > hi i am doing socket programming. how do i access the
      > value of a variable in one class in another class?[/color]

      You don't. The idea behind classes is to encapsulate data and provide a
      high-level interface that lets clients specify *what* the want to do
      rather than *how* they want to get things done. Class variables should
      always be manipulated by member functions.
      [color=blue]
      > is it possible to copy a socket descriptor of one class
      > to a socket descriptor of another class? if so how to do
      > it?[/color]

      Yes, you can copy your socket descriptors all around the place, but the
      resulting code will be a mess. If you don't want to hide low-level
      details behind a class interface, you can just as well program in pure C.

      For ample information on object-oriented socket programming, try



      Gerhard Menzl
      --
      Humans may reply by replacing the obviously faked part of my e-mail
      address with "kapsch".


      Comment

      Working...