473,671 Members | 2,550 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Client and server

3 New Member
I have written simple client and server program.Its work on same machine not work on different machine . what i do?
please tell me
Aug 28 '13 #1
6 1415
hosting charges
10 New Member
May be due to firewall/anti virus restriction.
Aug 28 '13 #2
numberwhun
3,509 Recognized Expert Moderator Specialist
You need to give us more details on what the "simple" client and server program is doing for its connectivity, functionality, etc. We know nothing about it and without more information, we can only theorize about possibilities. If you give us more info (or even share the code), then maybe we can provide more definitive avenues for investigation. Also, knowing what OS's your attempting to run it on would also be helpful.

Regards,

Jeff
Aug 29 '13 #3
Javagopal
3 New Member
ok.Thanks for your solution.how to solve firewall/anti virus restriction.ple ase sent me solution
Aug 29 '13 #4
buy domain
6 New Member
Are you getting errors like, "Could not open socket" from your client and server program? if yes, just use a 5 digit port.
Aug 29 '13 #5
Javagopal
3 New Member
The below code are my program
Expand|Select|Wrap|Line Numbers
  1. #Client program
  2. #!/usr/bin/perl
  3. use IO::Socket::INET;
  4. use strict;
  5.  
  6.  
  7. my $name = '24.221.34.34'; #Server IP
  8. my $port = '78901';
  9.  
  10. my $socket = IO::Socket::INET->new('PeerAddr' => $name,
  11.                                    'PeerPort' => $port,
  12.                                 'Proto' => 'tcp') or die "Can't create socket ($!)\n";
  13.  
  14. print "Client sending\n";
  15. while (1) {
  16.     my $msg = <STDIN>;
  17.     print $socket $msg;
  18.     print scalar <$socket>;
  19. }
  20. close $socket
  21.     or die "Can't close socket ($!)\n";
  22. #Server program 
  23.  
  24.  
  25. #!/usr/bin/perl
  26. use IO::Socket::INET;
  27. use strict;
  28.  
  29. my $port = "78901";
  30.  
  31. my $socket = IO::Socket::INET->new('LocalPort' => $port,
  32.                                    'Proto' => 'tcp',
  33.                                    'Listen' => SOMAXCONN)
  34.     or die "Can't create socket ($!)\n";
  35.     print "Socket connection";
  36.  
  37.  
  38. while (my $client = $socket->accept) {
  39.     my $name = gethostbyaddr($client->peeraddr, AF_INET);
  40.     my $port = $client->peerport;
  41.     while (<$client>) {
  42.         print "[$name $port] $_";
  43.         my @out = `$_`;
  44.         print @out;
  45.         print $client "$.: @out";
  46.     }
  47.     close $client
  48.         or die "Can't close ($!)\n";
  49. }
  50.  
  51. die "Can't accept socket ($!)\n";
  52.  
The client program have displayed below error
Can't create socket (No connection could be made because the target machine actvely refused it.)
please help me
Aug 29 '13 #6
numberwhun
3,509 Recognized Expert Moderator Specialist
First, you need to have the shebang line ( #!/usr/bin/perl) as the very first line in your script. If you put it anywhere BUT the first line, it is a comment and doesn't do anything.

Second, your issue, from reading the error, is on the second machine, which "actively refused it". I would start by troubleshooting why it refused the connection.

Another thing you can do is try printing "$!" as part of your die() function call as it prints the last error received.

Regards,

Jeff
Aug 29 '13 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

1
2634
by: ian maclure | last post by:
I'm writing a client-server app. Client controls Server which in turn configures and controls a bunch of hardware. I want to be able to start the server from my client. Now in C/C++ one could simply run the appropriate command string through a standard "system()" call which is relatively simple. JAVA on the other hand seems to require something like RMI to do it.
5
2561
by: Matt | last post by:
I think this is the basic concept in ASP server-side development. My boss told me web application is NOT client-server application. I argued with him because browser is the client, and the server code put in server. Then web application should be a client-server application. My understanding is that a web application is an application that runs on a browser. But client-server application is not necessary a web application. Please...
7
3301
by: rdh | last post by:
Hi all, I am in process of developing a Server in C++ supporting multiple protocols. The server will be exposing various functionalities, and the clients can communicate over any of the protocols may be TCP, IPX, SAP, NETBEUI to access the server to access the functionalities exposed. The server doesnot know in advance which client is using what protocol. ALSO, ALL THE INTERACTION WILL BE MADE OVER XML. example my server has...
7
3362
by: CT | last post by:
Hi, This might seem like a basic question but I have some doubts, please humour me. I have a client-server application using java where each client on each machine needs to directly communicate directly with the database. Do I need a separate db2 connect on each such machine. Please advice.
1
3146
by: alfredfx | last post by:
i'm planning to develop a client server system the client and server both able to upload picture client will upload the picture to a folder that reside in the server while server user can also upload picture to that folder also and then client and server can retrieve the picture from there. can someone giv some guide to me how to work this out ? i'v been lookin for solution. 1. using sqldatabase to store picture 2. ....
6
3724
by: Ken Allen | last post by:
I am relatively new to .Net and C#, but I hav ebeen programing in other languages and done some COM work for a number of years. I am attempting to understand how to map an older program architecture into .Net -- not looking to do it at this time, just to understand how I would achieve it. In the old environment, we had two classes, a client and a server class, that managed a data object. The server object knew how to interface with the...
0
1556
by: Derrick | last post by:
Hello all; This is going to be a bit long...sorry... I am about to start out on a small scale client/server type system. The server will collect data from various sources (custom hardware over ethernet), and make that data available to the clients (either webservices or remoting, not sure yet). Since the hardware is networked, the clients could talk to it directly, but I don't want to put the hardware through that load since...
3
2174
by: khu84 | last post by:
Here is client server very simple code, seems to work with telnet but with with web client code gives blank output. Following is the server code:- <? function createSocketServer($host='192.168.1.34',$port=2222) { $max_clients = 10;
2
4093
by: nsaffary | last post by:
hi I hava a client/server program that run correctly when i run it in one computer(local) but when I run client on a one computer and run server run on another, connection does not stablish.(I set server machine IP for client and server) please guide me? server : #include <winsock2.h> #include <iostream> #include <stdio.h> #include <string.h> #include <windows.h> #pragma comment(lib, "ws2_32");
0
1227
by: Maurizio | last post by:
I'd like to ask some suggestion regarding a software that I'm developping. For develop the project I've to use VB.NET and Framework 3.5 This is a Client Server application. I've some computer ( 1 server and 2 or 3 clients ) connected each other in LAN. This project is located in industial automation field.
0
8927
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...
1
8605
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7445
agi2029
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...
0
5703
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();...
0
4227
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...
0
4416
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2819
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
2
2062
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1816
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.