473,618 Members | 3,005 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2460
ne*****@gmail.c om 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.c om 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
1170
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
2345
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
1512
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# devs at our company can just drop in and use (it's an event and message passing system.) I'm sure, as most things C#/.Net, it's relatively simple, but if I can discover some caveats the easy way rather than the hard way I'm always up for that...
5
15096
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 one management console/monitor that receives messages and keeps track of keep-alive polling. The monitor created a new WinSock connection for each client that logged on. These were put into an array of controls. I'm sure this can also be done with...
8
5677
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 communication. It will be called by a multithreaded server application to send some data to an another server ( which is a linux server ).
1
1367
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 fine) Now, i want this client app to be able to connect to my server from outside the lan as well... Like i would like to give my user the ability to connect to my
8
4573
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 via serial port and serial/ethernet converter (MOXA NE-4100T) with TCP server. So communication is in that way: MyApplication(TCP client)-----------------(TCPServer)MOXA(serial)---(serial)LED Display
13
2717
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 exchange info with the web server. I don't familarize with C# programming and here I just want to know is that possible to implemented?
9
10721
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 to do, but would be able to communicate with each other and exchange filestreams over the internet, meaning in most cases communication with PC's behind a router and / or a gateway server. I have applications that can send messages to each other and...
0
8153
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8653
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8595
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8455
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6101
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4065
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2587
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1760
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1459
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.