Sponsored Content
Top Forums Programming To write C Script for connecting to a Server Post 302300780 by Nagesh on Wednesday 25th of March 2009 03:20:28 AM
Old 03-25-2009
Quote:
Originally Posted by pludi
Shell scripts, OTOH, are interpreted by the shell, as a quick way to automate routine tasks.
.
I did not understand the full form of OTOH?

thanks a lot for your elaborate reply .. now I got a better idea as to why scripts are used and why code is used.. !!
so I will try to code it in c and come up with a .EXE.

Is there anyway to call a .EXE( a application written in C ) in a script ?
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Connecting to SUN server from PC

I have old SUN server on my desk. I know it worked before. I want to be able to connect to server from my PC. Just to establish a dump terminal. 1. I connected to power socket 2. I Have a cable that fits in (i believe is a com ports there are A B slots the same I plugged it in A). They are... (33 Replies)
Discussion started by: zam
33 Replies

2. Shell Programming and Scripting

How to write a script by using unix commands to down any server

Hi, I need to do frequently server down and up. Every time i am using nearly 5 to 6 commands to down and agin i am using the commands to up. Can anybody help me to write a script to down and up. which i can use once on unix platform it can down later it can up the server. (1 Reply)
Discussion started by: sreerao
1 Replies

3. Solaris

NFS write failed for server.....error 11 (RPC: Server can't decode arguments)

Hello! I have a Linux nfs server (called server100 below) with a export nfs. My problem is that the Solaris client (called client100 below) doesn't seems to like it. In the Solaris syslog I got following messages (and after a while the solaris client behave liked its hanged/to buzy). Also see... (3 Replies)
Discussion started by: sap4ever
3 Replies

4. Shell Programming and Scripting

Connecting other server using ssh!

Hi All, Here i am having a problem in my script....:) i have one script which will connect from my linux box to antoher linux box.. let say...currently i am in 55.23.621.123 and i want to connect to another box which is 55.23.621.118 as we know we can connect using ssh... (2 Replies)
Discussion started by: Shahul
2 Replies

5. Shell Programming and Scripting

Connecting to multiple unix server from unix server using shell script

Hi Gurus, I'm a unix newbie and I would like to connect to multiple unix servers from unix server using shell script i.e from server a to server b,c,d etc. I want to copy the files from unix server a to server b, c, d. I can access staright using ssh without the need to have password and user... (5 Replies)
Discussion started by: sexyTrojan
5 Replies

6. Programming

How to write a shell script to connect to another server?

Hello friends I want to write a script in which I will connect to my friends network. I want to use SSH. Even they can use the script to log into my network and copy files. ssh user@hostname command I know the following command will help me to log into Google's servers and see all the... (12 Replies)
Discussion started by: Angelo
12 Replies

7. Shell Programming and Scripting

How to write a shell script for rsync to remote server?

Hello, Can you help me to write a shell script for rsync a folder from my server to remote server ? i do this in ssh by this command : rsync -avz -e ssh /copy/me/ login@serverip:/where/to i want have a shell script that do this command. and you know that this command ask remote... (0 Replies)
Discussion started by: Desperados
0 Replies

8. Shell Programming and Scripting

Script connecting to SFTP server

hi, i have to type a script that connect to a server SFTP(password not required) and run some easy command (e.g. ls,rm,mv,etc...). I wrote into the script the connection-string and the other commands. When I run it, it connects perfectly to the server but it stops at the home. Here is... (8 Replies)
Discussion started by: zangarules
8 Replies

9. Shell Programming and Scripting

Connecting to Windows server from UNIX through script

I am trying to connect to a Windows server say 10.1.1.10. This servers has a folder named RAJ in which there are multiple .zip files. All these zip files contain a text file called XYZ.txt. Now i have to merge the content of these XYZ.txt files from each of the .zip file and create a new text... (1 Reply)
Discussion started by: swapniljadav
1 Replies

10. UNIX for Advanced & Expert Users

How to write if condition in shell script for application server?

Hi all, I have a code to create folder in application server through shell script and i want to create if conditional based folder folder=$HOME/test/sample/whatever if ; then echo "$folder already exists, not created." else mkdir -p "$folder" > /dev/null 2>&1 ... (7 Replies)
Discussion started by: Boost
7 Replies
Net::Server::Proto(3)					User Contributed Perl Documentation				     Net::Server::Proto(3)

NAME
Net::Server::Proto - Net::Server Protocol compatibility layer SYNOPSIS
# Net::Server::Proto and its accompianying modules are not # intended to be used outside the scope of Net::Server. # That being said, here is how you use them. This is # only intended for anybody wishing to extend the # protocols to include some other set (ie maybe a # database connection protocol) use Net::Server::Proto; my $sock = Net::Server::Proto->object( $default_host, # host to use if none found in port $port, # port to connect to $default_proto, # proto to use if none found in port $server_obj, # Net::Server object ); ### Net::Server::Proto will attempt to interface with ### sub modules named simillar to Net::Server::Proto::TCP ### Individual sub modules will be loaded by ### Net::Server::Proto as they are needed. use Net::Server::Proto::TCP; # can be TCP/UDP/UNIX/etc ### Return an object which is a sub class of IO::Socket ### At this point the object is not connected. ### The method can gather any other information that it ### needs from the server object. my $sock = Net::Server::Proto::TCP->object( $default_host, # host to use if none found in port $port, # port to connect to $server_obj, # Net::Server object ); ### Log that a connection is about to occur. ### Use the facilities of the passed Net::Server object. $sock->log_connect( $server ); ### Actually bind to port or socket file. This ### is typically done by calling the configure method. $sock->connect(); ### Allow for rebinding to an already open fileno. ### Typically will just do an fdopen. $sock->reconnect(); ### Return a unique identifying string for this sock that ### can be used when reconnecting. my $str = $sock->hup_string(); ### Return the proto that is being used by this module. my $proto = $sock->NS_proto(); DESCRIPTION
Net::Server::Proto is an intermediate module which returns IO::Socket style objects blessed into its own set of classes (ie Net::Server::Proto::TCP, Net::Server::Proto::UNIX). Only three or four protocols come bundled with Net::Server. TCP, UDP, UNIX, and eventually SSL. TCP is an implementation of SOCK_STREAM across an INET socket. UDP is an implementation of SOCK_DGRAM across an INET socket. UNIX uses a unix style socket file and lets the user choose between SOCK_STREAM and SOCK_DGRAM (the default is SOCK_STREAM). SSL is actually just a layer on top of TCP. The protocol that is passed to Net::Server can be the name of another module which contains the protocol bindings. If a protocol of MyServer::MyTCP was passed, the socket would be blessed into that class. If Net::Server::Proto::TCP was passed, it would get that class. If a bareword, such as tcp, udp, unix or ssl, is passed, the word is uppercased, and post pended to "Net::Server::Proto::" (ie tcp = Net::Server::Proto::TCP). METHODS
Protocol names used by the Net::Server::Proto should be sub classes of IO::Socket. These classes should also contain, as a minimum, the following methods: object Return an object which is a sub class of IO::Socket At this point the object is not connected. The method can gather any other information that it needs from the server object. Arguments are default_host, port, and a Net::Server style server object. log_connect Log that a connection is about to occur. Use the facilities of the passed Net::Server object. This should be an informative string explaining which properties are being used. connect Actually bind to port or socket file. This is typically done internally by calling the configure method of the IO::Socket super class. reconnect Allow for rebinding to an already open fileno. Typically will just do an fdopen using the IO::Socket super class. hup_string Return a unique identifying string for this sock that can be used when reconnecting. This is done to allow information including the file descriptor of the open sockets to be passed via %ENV during an exec. This string should always be the same based upon the configuration parameters. NS_proto Net::Server protocol. Return the protocol that is being used by this module. This does not have to be a registered or known protocol. show Similar to log_connect, but simply shows a listing of which properties were found. Can be used at any time. PORT
The port is the most important argument passed to the sub module classes and to Net::Server::Proto itself. For tcp, udp, and ssl style ports, the form is generally host:port/protocol, host|port|protocol, host/port, or port. For unix the form is generally socket_file|type|unix or socket_file. You can see what Net::Server::Proto parsed out by looking at the logs to see what log_connect said. You could also include a post_bind_hook similar to the following to debug what happened: sub post_bind_hook { my $self = shift; foreach my $sock ( @{ $self->{server}->{sock} } ){ $self->log(2,$sock->show); } } Rather than try to explain further, please look at the following examples: # example 1 ################################### $port = "20203"; $def_host = "default_domain.com"; $def_proto = "tcp"; $obj = Net::Server::Proto->object($def_host,$port,$def_proto); # ref = Net::Server::Proto::TCP # NS_host = default_domain.com # NS_port = 20203 # NS_proto = TCP # example 2 ################################### $port = "someother.com:20203"; $def_host = "default_domain.com"; $def_proto = "tcp"; $obj = Net::Server::Proto->object($def_host,$port,$def_proto); # ref = Net::Server::Proto::TCP # NS_host = someother.com # NS_port = 20203 # NS_proto = TCP # example 3 ################################### $port = "someother.com:20203/udp"; $def_host = "default_domain.com"; $def_proto = "tcp"; $obj = Net::Server::Proto->object($def_host,$port,$def_proto); # ref = Net::Server::Proto::UDP # NS_host = someother.com # NS_port = 20203 # NS_proto = UDP # example 4 ################################### $port = "someother.com:20203/Net::Server::Proto::UDP"; $def_host = "default_domain.com"; $def_proto = "TCP"; $obj = Net::Server::Proto->object($def_host,$port,$def_proto); # ref = Net::Server::Proto::UDP # NS_host = someother.com # NS_port = 20203 # NS_proto = UDP # example 5 ################################### $port = "someother.com:20203/MyObject::TCP"; $def_host = "default_domain.com"; $def_proto = "tcp"; $obj = Net::Server::Proto->object($def_host,$port,$def_proto); # ref = MyObject::TCP # NS_host = someother.com # NS_port = 20203 # NS_proto = TCP (depends on MyObject::TCP module) # example 6 ################################### $port = "/tmp/mysock.file|unix"; $def_host = "default_domain.com"; $def_proto = "tcp"; $obj = Net::Server::Proto->object($def_host,$port,$def_proto); # ref = Net::Server::Proto::UNIX # NS_host = undef # NS_port = undef # NS_unix_path = /tmp/mysock.file # NS_unix_type = SOCK_STREAM # NS_proto = UNIX # example 7 ################################### $port = "/tmp/mysock.file|".SOCK_DGRAM."|unix"; $def_host = ""; $def_proto = "tcp"; $obj = Net::Server::Proto->object($def_host,$port,$def_proto); # ref = Net::Server::Proto::UNIX # NS_host = undef # NS_port = undef # NS_unix_path = /tmp/mysock.file # NS_unix_type = SOCK_DGRAM # NS_proto = UNIX # example 8 ################################### $port = "/tmp/mysock.file|".SOCK_DGRAM."|unix"; $def_host = ""; $def_proto = "UNIX"; $obj = Net::Server::Proto->object($def_host,$port,$def_proto); # ref = Net::Server::Proto::UNIX # NS_host = undef # NS_port = undef # NS_unix_path = /tmp/mysock.file # NS_unix_type = SOCK_DGRAM # NS_proto = UNIX LICENCE
Distributed under the same terms as Net::Server perl v5.12.1 2007-02-03 Net::Server::Proto(3)
All times are GMT -4. The time now is 11:21 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy