473,511 Members | 14,393 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 1408
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.please 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
2629
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...
5
2543
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...
7
3281
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...
7
3347
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...
1
3135
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...
6
3705
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...
0
1549
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...
3
2161
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...
2
4084
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...
0
1215
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...
0
7148
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...
0
7367
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,...
1
7089
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...
0
7517
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...
1
5072
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...
0
4743
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...
0
3230
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...
0
3217
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
451
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...

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.