473,289 Members | 1,848 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,289 software developers and data experts.

Socket communication on multihomed box

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.88), 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.98). 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

Jun 3 '06 #1
2 2443
ne*****@gmail.com 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

Jun 3 '06 #2
Thanks, I'll check it out.

Jonathan Mcdougall wrote:
ne*****@gmail.com 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


Jun 3 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Jacoste | last post by:
Using Socket communication under Terminal Services. Are there some kind of "virtual sockets", so that my app. can use the same port for different users on the same Terminal Server? /Jacoste
4
by: Sa¹o Zagoranski | last post by:
Hi! I'm writing a simple 3D First person shooter game. It is a multiplayer game, where all the players connect to one server.
2
by: WTH | last post by:
with a C# client (and/or server, but server not important)? I've got a scalable high speed (uses completion ports) C++ TCP/IP communication server but I'd like to write a C# client that other C#...
5
by: Rotzooi | last post by:
Hi, In the past I created a VB6 application that was capable of accepting multiple client connections for status logging over the internet using simple non-Windows clients (GSM/GPRS). There is...
8
by: Roodie | last post by:
Hello, I have a quite specific problem, and after half a day spent with Google, still no solid answer. The task: I have to write a C# class Library ( DLL ) to handle TCP socket...
1
by: batista | last post by:
Hi, My problem is that i have a client which was, uptil now, running inside a lan and using sokcet communication to connect to server which is also insdie the same lan.....(it was all working...
8
by: panko | last post by:
Hello, I can't manage with asynchronous socket communication. :( I wrote a class CSocket.cs. This class is taking care of sending strings to LED display. This display is actually communicating...
13
by: Wade Yin | last post by:
Hi, If I can write a ActiveX component that can support socket communication in webpage, that will make browser have strongger capability to communicate with different clients, but not only can...
9
by: cnixuser | last post by:
Hi, I was wondering if someone could give me some general pointers about creating client server applications that would be able to communicate with each other over not just the LAN which I am able...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.