Hi,
We have a socket server app in Java and the client application in C++.
When we try to connect 60 clients simultaneously from C++ using
threads, only 55-56 connections are successfull, rest are not
connected(Conne ction refused error).
For one connection everything works fine. In server side each
connection is handled in seperate thread.
Is there anything else to be done?
The server code is as follows.
public class SocketServer
{
public static void main(String args[])
{
ServerSocket Server = null;
Socket clientSocket = null;
try
{
Server = new ServerSocket(79 99,60);
}
catch (IOException e)
{
System.out.prin tln(e);
}
try
{
while (true)
{
clientSocket = Server.accept() ;
SocketThread objThread = new SocketThread(cl ientSocket);
objThread.start ();
}
}
catch (Exception e)
{
System.out.prin tln(e);
}
finally
{
try
{
Server.close();
}
catch (IOException e)
{
System.out.prin tln(e);
}
}
}
} 2 11292
On 28 May 2004 22:16:10 -0700, Rajesh wrote: We have a socket server app in Java and the client application in C++.
When we try to connect 60 clients simultaneously from C++ using threads, only 55-56 connections are successfull, rest are not connected(Conne ction refused error).
For one connection everything works fine. In server side each connection is handled in seperate thread.
Is there anything else to be done?
You have likely run into an OS-imposed descriptor limit on the server.
You don't say what OS you are using, but on unix you can use ulimit to
check or modify the limit.
I was going to suggest that you look at changing the backlog in the
ServerSocket constructor (in case your clients are connecting too
quickly for the server to handle), but see now that you've already set
it to 60.
I assume that SocketThread closes the Socket when it's done handling
the client?
/gordon
--
[ do not email me copies of your followups ]
g o r d o n + n e w s @ b a l d e r 1 3 . s e
just because you have allocated 60 clients doesn't mean that the server
has to connect them all on the first try. connecting sockets is a
dynamic relationship... in otherwords if at first your client does not
succeed, get it to try again after so many seconds...
- perry
Rajesh wrote: Hi, We have a socket server app in Java and the client application in C++.
When we try to connect 60 clients simultaneously from C++ using threads, only 55-56 connections are successfull, rest are not connected(Conne ction refused error).
For one connection everything works fine. In server side each connection is handled in seperate thread.
Is there anything else to be done?
The server code is as follows. public class SocketServer { public static void main(String args[]) {
ServerSocket Server = null; Socket clientSocket = null;
try { Server = new ServerSocket(79 99,60); } catch (IOException e) { System.out.prin tln(e); }
try { while (true) { clientSocket = Server.accept() ; SocketThread objThread = new SocketThread(cl ientSocket); objThread.start (); } } catch (Exception e) { System.out.prin tln(e); } finally {
try { Server.close(); } catch (IOException e) { System.out.prin tln(e); } }
} } This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Dominique |
last post by:
I am trying to communicate to a prolog server from a java client,
however even though the connection is successfully made every time I
try to perform QueryExecute I get an error, either Socket closed or
null etc. Can anyone help? I am using SICStus prolog.
Currently my prolog server looks like:
:- write('starting'),nl.
:- use_module(library(sockets)).
:- use_module(library(prologbeans)).
:- use_module(library(charsio)).
|
by: Krzysztof Pa¼ |
last post by:
Hi,
I want to make simple client in phyton, which would be able to communicate
with Java server using SSL sockets.
There is the Java clients, which is doing this - so I'm pretty sure, that
Java server works OK.
I've heard, that P2.3 has SSL support included in himself and also, I was
trying P2.2 with pyOpenSSL wrappers and extensions, but unsuccesfuly...
So, could you give me a few lines of python code which makes such things:
|
by: netgeni59 |
last post by:
Hello fellow C# friends,
I am trying to write a C# TCP client that was formerly written in Java.
The server must still remain in Java.
I cannot get text data from the C# client to be received by the Java
TCP server. No matter how I try to send data from the client to the
server, the Java server DataInputStream readUTF() method never returns
with any data. Can someone please shed some light on this problem?
Thanks.
|
by: yaron |
last post by:
Hi,
I have a problem when sending data over TCP socket from c# client to java
server.
the connection established ok, but i can't send data from c# client to java
server.
it's work ok with TcpClient, NetworkStream and StreamWriter classes.
but with low level socket it doesn't work (When using the Socket class Send
method).
|
by: mohana |
last post by:
hi,
i just want 2 communicate with the near by computer. i got this program from internet. i have two programs called Server.java and Client.java.
i am putting that program here now,
Server.java Program:
import java.net.*;
import java.io.*;
public class Server
| |
by: happyvalley |
last post by:
Hi,
don't know if it is the place to ask this question
I have a c++ server and a java client communicate via socket
in Java client
// create a client socket
Socket clientSocket = new Socket("localhost", 27015);
PrintWriter out = new PrintWriter(clientSocket.getOutputStream(),
true);
|
by: akmkat |
last post by:
Hi all,
I am in a great problem. I am trying to implement a multithreaded server using java, first look at the code...
/*------- Main Server (server.java)--------------*/
import java.io.* ;
import java.net.* ;
public class server
{
|
by: TsanChung |
last post by:
I want to make a java TCP socket client to communicate with a TCP
server socket on linux.
Are there some sample C unix server and java client socket programs
available?
The Richard Stevens' "Unix network programming" book described a TCP
server (tcpcliserv04.c) and client (tcpcli04.c). I compiled and
executed them successfully as follows:
$ tcpcliserv04 &
|
by: Elaine121 |
last post by:
Hi i've been batteling for hours and can't seem to find the problem. When my server runs and I press the connect button the gui freezes until the client gui is terminated.. only then the gui becomes active again and displays the messages.
Here is my server code:
import java.io.*;
import java.net.*;
public class serverForm extends javax.swing.JFrame {
private PrintWriter output = null;
|
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,...
|
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...
| |
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...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
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...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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...
| |