Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Socket communication on multihomed box

Reply
Thread Tools

Socket communication on multihomed box

 
 
ne.seri@gmail.com
Guest
Posts: n/a
 
      06-03-2006
In short, I'm building a kind of server which is supposed to handle
open connections with clients. E.g. client connects to the server, the
connection stays open, client sends a request to the server, server
reasoned, and so on...
The thing is that connection MUST always stay open. I'm using C++, and
as for sockets, I'm using native syscalls, not MFC. I'm using stream
sockets for communication.

Another thing is that is should work both under Linux and Windows. The
code is pretty portable except the part with sockets and threads. I
created wrapper classes that implement syscalls for handling threads
and sockets, which have the same interface for the rest of my code, but
implement a bit differently under Windows and Linux (of course .
However this is not the problem. It's working just fine for both OSes.

The problem I have are the sockets. Everything was working just fine
until I recently installed an USB bluetooth adapter to my computer
(Windows). Now, the program won't even connect using a connect()
syscall. It returns with an error: 10061 - WSAECONNREFUSED.

Let me also mention that the program is working just fine both on
another Windows box, and another Linux box (Mandrake 10).

As I dig a bit deeper, I found out that my computer now has two network
adapters - using gethostbyname(). The first one is Bluetooth
(192.168.2.1), the second one is LAN (192.168.1.8, and I guess that
this is what's causing the problems. Of course, I confirmed this with
ipconfig command.

My program is supposed to communicate using LAN interface of course,
but it just doesn't, so it seems to me.

Another thing is when I try to connect to Windows from a Linux box
(Linux is 192.168.1.9. The Windows program detects the incoming
connection in accept(). It creates another socket for communication.
But when it comes to receiving data it just goes crazy...
It receives data with recv() syscall. I can clearly see the data
received in buffer using a debugger, but recv() returns with some
strange number (e.g. -8362460 ???) instead of returning with the number
of bytes received, or 0, or -1, right?

Sometimes it returns with -1, and the error is the same 10061 -
WSAECONNREFUSED.

Let me mention another thing, everything else (that uses sockets) seems
to work on this Windows box with bluetooth adapter. IE, Outlook, Skype,
eMule, putty, Total Commander (FTP), Editplus (FTP and SFTP),
FlashGet...

Has anybody got any ideas what could cause such a strange behaviour? I
even tried the basic examples I first downloaded when I started with
this program. The server/client programs that exchange a few bytes and
terminate. But they also fail now - was working before.

I read that you can make sockets to use a specific network interface
for connection. How can I try this out? Has anybody got some sample
code for this?

I'm just going nuts with this. I can't find a solution for this
behavior.

Thanks in advance,
Goran

 
Reply With Quote
 
 
 
 
Jonathan Mcdougall
Guest
Posts: n/a
 
      06-03-2006
http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:
> In short, I'm building a kind of server which is supposed to handle
> open connections with clients. E.g. client connects to the server, the
> connection stays open, client sends a request to the server, server
> reasoned, and so on...


Unfortunately, this newsgroup only deals with the C++ language itself,
not all its possible applications and libraries. See
http://www.parashift.com/c++-faq-lit...t.html#faq-5.9 for a
list of possible newsgroups.

Good luck.


Jonathan

 
Reply With Quote
 
 
 
 
ne.seri@gmail.com
Guest
Posts: n/a
 
      06-03-2006
Thanks, I'll check it out.

Jonathan Mcdougall wrote:
> (E-Mail Removed) wrote:
> > In short, I'm building a kind of server which is supposed to handle
> > open connections with clients. E.g. client connects to the server, the
> > connection stays open, client sends a request to the server, server
> > reasoned, and so on...

>
> Unfortunately, this newsgroup only deals with the C++ language itself,
> not all its possible applications and libraries. See
> http://www.parashift.com/c++-faq-lit...t.html#faq-5.9 for a
> list of possible newsgroups.
>
> Good luck.
>
>
> Jonathan


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: socket.unbind or socket.unlisten? - socket.error: (48, 'Addressalready in use') Steve Holden Python 0 02-01-2009 12:45 PM
Re: socket.unbind or socket.unlisten? - socket.error: (48, 'Addressalready in use') Laszlo Nagy Python 0 02-01-2009 07:37 AM
socket.unbind or socket.unlisten? - socket.error: (48, 'Addressalready in use') Laszlo Nagy Python 1 01-27-2009 05:05 PM
Re: socket.unbind or socket.unlisten? - socket.error: (48,'Address already in use') Jean-Paul Calderone Python 0 01-27-2009 01:41 PM
Slow opening socket on ASP with multihomed machine Jim W ASP General 2 10-22-2004 08:08 PM



Advertisments