LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 07-27-2008, 11:58 AM   #1
kalleanka
Member
 
Registered: Aug 2003
Location: Mallorca, Spain
Distribution: xubuntu
Posts: 551

Rep: Reputation: 38
How do I send a string over the internet to my server?


I need to send a string to a server from a machine on the net.

Any Idees?

I work in c but I can do it throw a script.

Last edited by kalleanka; 07-27-2008 at 12:00 PM.
 
Old 07-27-2008, 12:14 PM   #2
jcookeman
Member
 
Registered: Jul 2003
Location: London, UK
Distribution: FreeBSD, OpenSuse, Ubuntu, RHEL
Posts: 417

Rep: Reputation: 33
Code:
#!/bin/env bash
SERVER="myserver.mydomain.com"
PORT=80
echo "String" > /dev/tcp/$SERVER/$PORT
This is a Bashism and only works in Bash, but it's very convenient.
 
Old 07-27-2008, 12:39 PM   #3
kalleanka
Member
 
Registered: Aug 2003
Location: Mallorca, Spain
Distribution: xubuntu
Posts: 551

Original Poster
Rep: Reputation: 38
wow that easy! thanks a lot.
 
Old 07-27-2008, 01:02 PM   #4
kalleanka
Member
 
Registered: Aug 2003
Location: Mallorca, Spain
Distribution: xubuntu
Posts: 551

Original Poster
Rep: Reputation: 38
how about the server side? any idee?
 
Old 07-27-2008, 01:51 PM   #5
raconteur
Member
 
Registered: Dec 2007
Location: Slightly left of center
Distribution: slackware
Posts: 276
Blog Entries: 2

Rep: Reputation: 44
Quote:
Originally Posted by kalleanka View Post
how about the server side? any idee?
Your server needs to be listening on the specified port -- in the above case, httpd will listen on port 80 by default, but you will need to set up some rule to deal with the non-html input.

Alternatively, you can send an html-wrapped string via curl or ftp (different port and protocol) with wput and listen for those things on the server with httpd or an ftp server program.
 
Old 07-27-2008, 02:08 PM   #6
kalleanka
Member
 
Registered: Aug 2003
Location: Mallorca, Spain
Distribution: xubuntu
Posts: 551

Original Poster
Rep: Reputation: 38
ok, never done it now I can serch for it. Thanks.
 
  


Reply

Tags
bash, socket


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Send email to internet from 2nd SuSE via internal postfix server joadoor Linux - Networking 2 12-25-2006 10:40 AM
sockets: Send string to server introuble Programming 13 07-02-2006 06:38 PM
Send string to std output without interpreting (script) ta0kira Programming 6 06-29-2005 08:50 AM
Send query string via MIRC script cadj Programming 0 08-25-2004 06:25 AM
SENDMAIL as an SMTP RELAY SERVER that can send email to internet. how? kublador Linux - Software 7 10-25-2003 08:43 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:54 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration