sync. sockets w/vb.net

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

    #1

    sync. sockets w/vb.net

    I'm toying with the idea of swaping out some of my C++
    client and server socket programs with vb.net equivs. but
    I finding that the examples included in the msdn do not
    seem to interoperate with the existing C++ programs. For
    example, if I use my existing C++ client app to call the
    vb.net syncronous socket server example, the server
    example will never accept the connection(I get an error in
    the client app). But, I can telnet to the msdn server
    example and I can also make the msdn vb.net client socket
    example work with it. It's all pretty straight forward
    sockets(ie. AF_NET, STREAM, TCP). Is there a difference
    in the way that sockets are implmented with .net that I'm
    missing in the documentation that I'm missing.

    Also, the client is getting a wsgetlasterror( ) of 10061..

    Thanks for any help,
    Luke


  • George Gre

    #2
    Re: sync. sockets w/vb.net


    But reading your initial post again it looks that maybe its your C++ client.
    Maybe you are not doing something "normal" in TCP as you think you do.

    Sorry but I cannot help you further without more info (some code?).

    - George.


    "Luke Balding" <lbalding@nackw are.com> wrote in message
    news:765b01c34b ec$8ff68a10$7d0 2280a@phx.gbl.. .[color=blue]
    > Thanks for the quick reply. Both the C++ client and
    > vb.net server are on the same machine. the server is
    > listening on 127.0.0.1 2050 and the client tries to
    > connect to it on the same address..
    >
    > Luke
    >[color=green]
    > >-----Original Message-----
    > >Hi,
    > >
    > >I have receintly made a c# tcp server, having c++ clients[/color]
    > connected to it[color=green]
    > >with no problems.
    > >
    > >Are you trying to connect from another PC ? Have you got[/color]
    > more than one TCP[color=green]
    > >adapters installed on you PC?
    > >
    > >-George.
    > >
    > >"Luke Balding" <lbalding@nackw are.com> wrote in message
    > >news:075901c34 b75$b436c150$a5 01280a@phx.gbl. ..[color=darkred]
    > >> I'm toying with the idea of swaping out some of my C++
    > >> client and server socket programs with vb.net equivs.[/color][/color]
    > but[color=green][color=darkred]
    > >> I finding that the examples included in the msdn do not
    > >> seem to interoperate with the existing C++ programs.[/color][/color]
    > For[color=green][color=darkred]
    > >> example, if I use my existing C++ client app to call the
    > >> vb.net syncronous socket server example, the server
    > >> example will never accept the connection(I get an error[/color][/color]
    > in[color=green][color=darkred]
    > >> the client app). But, I can telnet to the msdn server
    > >> example and I can also make the msdn vb.net client[/color][/color]
    > socket[color=green][color=darkred]
    > >> example work with it. It's all pretty straight forward
    > >> sockets(ie. AF_NET, STREAM, TCP). Is there a difference
    > >> in the way that sockets are implmented with .net that[/color][/color]
    > I'm[color=green][color=darkred]
    > >> missing in the documentation that I'm missing.
    > >>
    > >> Also, the client is getting a wsgetlasterror( ) of[/color][/color]
    > 10061..[color=green][color=darkred]
    > >>
    > >> Thanks for any help,
    > >> Luke
    > >>
    > >>[/color]
    > >
    > >
    > >.
    > >[/color][/color]


    Comment

    • Luke Balding

      #3
      Re: sync. sockets w/vb.net

      G,

      I found the problem. It appears the 2050 is associated
      with ESF somehow and the routine I use create the ADDR_IN
      calls getservbyname. It looks like b/c the port 2050 is
      related to ESF somehow the PSE object was passed back as
      not null and, as the logic below goes, the port was added
      psin in the intel reverse byte order iso the "natural"
      byte order.

      pse = getservbyname(p szServ, szServType);
      if (pse == NULL)
      {
      int err = WSAGetLastError ();
      s_port = _ttoi(pszServ);
      if (s_port == 0)
      return FALSE;
      else
      s_port = htons(s_port);
      }
      else
      s_port = pse->s_port;
      psin->sin_port = s_port;

      Thanks for the help,

      Luke
      [color=blue]
      >-----Original Message-----
      >
      >But reading your initial post again it looks that maybe[/color]
      its your C++ client.[color=blue]
      >Maybe you are not doing something "normal" in TCP as you[/color]
      think you do.[color=blue]
      >
      >Sorry but I cannot help you further without more info[/color]
      (some code?).[color=blue]
      >
      >- George.
      >
      >
      >"Luke Balding" <lbalding@nackw are.com> wrote in message
      >news:765b01c34 bec$8ff68a10$7d 02280a@phx.gbl. ..[color=green]
      >> Thanks for the quick reply. Both the C++ client and
      >> vb.net server are on the same machine. the server is
      >> listening on 127.0.0.1 2050 and the client tries to
      >> connect to it on the same address..
      >>
      >> Luke
      >>[color=darkred]
      >> >-----Original Message-----
      >> >Hi,
      >> >
      >> >I have receintly made a c# tcp server, having c++[/color][/color][/color]
      clients[color=blue][color=green]
      >> connected to it[color=darkred]
      >> >with no problems.
      >> >
      >> >Are you trying to connect from another PC ? Have you[/color][/color][/color]
      got[color=blue][color=green]
      >> more than one TCP[color=darkred]
      >> >adapters installed on you PC?
      >> >
      >> >-George.
      >> >
      >> >"Luke Balding" <lbalding@nackw are.com> wrote in message
      >> >news:075901c34 b75$b436c150$a5 01280a@phx.gbl. ..
      >> >> I'm toying with the idea of swaping out some of my[/color][/color][/color]
      C++[color=blue][color=green][color=darkred]
      >> >> client and server socket programs with vb.net equivs.[/color]
      >> but[color=darkred]
      >> >> I finding that the examples included in the msdn do[/color][/color][/color]
      not[color=blue][color=green][color=darkred]
      >> >> seem to interoperate with the existing C++ programs.[/color]
      >> For[color=darkred]
      >> >> example, if I use my existing C++ client app to call[/color][/color][/color]
      the[color=blue][color=green][color=darkred]
      >> >> vb.net syncronous socket server example, the server
      >> >> example will never accept the connection(I get an[/color][/color][/color]
      error[color=blue][color=green]
      >> in[color=darkred]
      >> >> the client app). But, I can telnet to the msdn[/color][/color][/color]
      server[color=blue][color=green][color=darkred]
      >> >> example and I can also make the msdn vb.net client[/color]
      >> socket[color=darkred]
      >> >> example work with it. It's all pretty straight[/color][/color][/color]
      forward[color=blue][color=green][color=darkred]
      >> >> sockets(ie. AF_NET, STREAM, TCP). Is there a[/color][/color][/color]
      difference[color=blue][color=green][color=darkred]
      >> >> in the way that sockets are implmented with .net that[/color]
      >> I'm[color=darkred]
      >> >> missing in the documentation that I'm missing.
      >> >>
      >> >> Also, the client is getting a wsgetlasterror( ) of[/color]
      >> 10061..[color=darkred]
      >> >>
      >> >> Thanks for any help,
      >> >> Luke
      >> >>
      >> >>
      >> >
      >> >
      >> >.
      >> >[/color][/color]
      >
      >
      >.
      >[/color]

      Comment

      Working...