Send and receive data to/from a local IP address in Java

I'm new to java and now I have a problem in using Ethernet port in Java . I have a device which can send and receive data by Ethernet . I connect it to a switch and when I enter its IP address in a browser I can see the data that the device sent ( the data is some HTML code ). But now I want to do it by a java application . If anyone can help me or send some sample code I would be grateful . thanks

-------------Problems Reply------------

I think tutorials on socket programming will help you.
https://docs.oracle.com/javase/tutorial/networking/sockets/

A very brief code may look like this:

Socket socket = new Socket(ipAddressOfDevice);
InputStream in = socket.getInputStream();
OutputStream out = socket.getOuputStream();
PrintWriter pw = new PrintWriter(out);
pw.write(yourHttpRequest);
BufferedReader br = new BufferedReader(new InputStreamReader(in));
String oneLineOfInput = br.readLine();
System.out.println(oneLineOfInput);

Category:java Views:10 Time:2019-02-09

Related post

  • Live Mail will not send or receive, to or from a user email address on the computer. 2014-02-24

    I have a new laptop, with Windows 7. I have 2 users on the computer, 1 for my personal life and 1 for my business. There are 2 email addresses on 1 user and 3 on the other. GoDaddy is hosting 2, Comcast 2 and Century Link 1. I am in the process of le

  • Can I use NSStream, NSInputStream, and NSOutputStream to send and receive data from a C# application? 2010-09-22

    Can I use NSStream,NSInputStream, and NSOutputStream to send and receive data from a C# application or service? If so, how? --------------Solutions------------- Yes. Apple's CocoaEcho or SimpleNetworkStreams sample code projects should get you starte

  • Sending and receiving data from Flash AS3 to PHP 2011-07-29

    I know this is frequently asked, but I have looked all over the internet to find the mistake I'm making with the code I've used to send and receive data from AS3 to PHP and viceversa. Can you find the mistake? Here is my code: AS3: import flash.event

  • how do i configure windows 7 to allow domains to send and receive data from the Internet 2013-09-20

    im trying to download purchased items from itunes but i cant due to i can not figure out to changing my windows 7 settings to allow the domains needed for itunes to send and receive data from the internet. i have already troubleshot my connection wit

  • How to send and receive data in Android Programming using bluetooth without pairing? 2011-06-27

    I am new to Android programming, and have java concept, I want to know that how can I send and receive data using bluetooth without pairing or any password (Only if both device has my app installed), any suggestion? --------------Solutions-----------

  • Sending and Receiving data through SOAP web service in .Net 2010-01-20

    I am working on a client - server application and in which I used to send and receive data through SOAP web service. Now after sometimes I have heard from someone that I might lost some data while this process on soap service created in ASP.net. So n

  • Game Center Send and Receive Data 2011-01-01

    EDIT: I have made a clean, new project, but still can't get it working. Please download it, there is a little code to look at and probably easy for a professional or anyone remotely experience to see whats I am doing wrong. Just trying to send that i

  • Sending and receiving data streams in Delphi with INDY 10 2011-10-20

    This is a continuation of Sending and receiving data streams in Delphi. I am going to send an image using TCP/IP and then going to update the changes in that image using UDP by dividing the picture in to small pieces and sending only the pieces that

  • how to send and receive data and acknowledgement asynchrounously in c++ socket tcp/ip? 2011-11-15

    how to send and receive data and acknowledgement asynchrounously in c++ socket tcp/ip?, i can see in my program as when send some 145 byte data 50 times , i will be receiving the acknowledgement for the first six as it takes time to give the acknowle

  • Concurrent send and receive data in one port with udpclient 2011-11-29

    I'm trying to send and receive data to a specific endpoint with local port 50177. Send data does very good, but when the program tries to receive data it can't receive any. When I sniff the network with Wireshark I see that server sent data to me. I

  • Use PHP socket to send and receive data 2012-01-23

    I'm trying to send and receive data by PHP socket. Evrything is OK but when I'm trying to send data PHP does not send anything (Wireshark told me that sent data length was 0). I'm using this code: <?php $address = 'example.com'; $port = 1234; $soc

  • send and receive data via bluetooth 2014-08-01

    you can say that i'm new in android development, i need some help to synchronize some data in two devices with my application, i have done all necessary things like searching for available devices and pairing and unpairing ... all what i need now is

  • How to send and receive an object from PC to an Android Device 2010-12-23

    I am getting trouble in sending and receiving an objects From Pc to An Android device. I tried using ObjectInputStream, but I wasn't able to get it to work. Any suggestions? --------------Solutions------------- The following example shows how to copy

  • Sending And Receiving Data Via Game Center (GameKit) Over 3G Stops Working 2012-03-31

    I have a Game Center matchmaker working and implemented, and by using Game Kit's Bluetooth functionality I know that my multiplayer code works. When playing over the internet through the Game Center sandbox, it works when both devices are on WiFi, bu

  • Unable to send and receive an email from Gmail using Windows Live mail. 2012-11-09

    Hi All, I have a problem when adding my Windowslive email address in Gmail (which I would like to send from Gmail account using WIndowslive email address), I could push email from windowslive to gmail, but couldn't add my email address somehow. Error

  • TcpServer - Sending and Receiving Data 2009-10-16

    I'm having to write a TCP Server for a project at work and I googled around how to. I got an MSDN answer and managed to get it working, but I have no clue how to get data to be able to receive back and forth. The sockets aren't going to be connected

  • Send and receive data trough the power network 2009-11-27

    I'm not interested in a hardware solution, I want to know about software that may "read" modulated signal received trough the power supply - some sort of a low-level driver that would access the power signal in a convenient place and demodulate it. I

  • Sending and receiving E-Mail from a specific person. 2012-11-27

    A specific person has been blocked from my Outlook account. Would like to unblock. --------------Solutions------------- Hi Bob GigiGOLDY, Thank you for posting your concern here at the Microsoft Community forum. First of all, we apologize for the del

  • How can I send and receive e-mail from my hotmail using outlook 2003 2014-05-21

    Original Title: IS THERE A WAY I CAN SEND AND RECEIVE E-MAIL USING OUTLOOK 2003 HOW CAN I OPEN MY OUTLOOK 2003 INBOX AND SEND/RECEIVE EMAILS FROM MY HOTMAIL? --------------Solutions------------- Install Outlook Connector: http://office.microsoft.com/

  • How to send and get data to/from SSH Tunnel in java (jsch )? 2011-09-21

    I am a begginer to SSH Tunnels and I am trying to find a way to implement an SSH tunnel between host and server and through this tunnel, I want to send and get datas. I have searched on the net and I have seen that " jsch " can help me to implement a

  • I want to send and receive sms through serial comport using gsm modem in java 2011-04-26

    I want to implement Java code to send and receive sms through serial comport using gsm modem. Before implementing this I need Java communication api for this. If so please let me know from where I have to download for Windows Xp? --------------Soluti

  • Sending and receiving via IMAP using a different email address 2014-08-02

    I've got my own domain name but the package doesn't come with email accounts, so I'd like to set up the email address *** Email address is removed for privacy *** and pick this up via Outlook.com, with whom I already have an account. I can set up ema

  • Access USB port from C# and send and receive data 2010-11-24

    How to access a USB port in C#, send a data stream and receive other data? --------------Solutions------------- there's a .net library for that: SharpUSBLib http://www.icsharpcode.net/OpenSource/SharpUSBLib/default.aspx The term "usb port" doesn't me

  • How do I get a PHP script to send and receive data from an already running process? 2008-12-05

    I'm trying to create a simple AJAX to Telnet client for the web. I may be re-inventing the wheel by doing this, but it is a learning project for myself. At the moment I haven't written anything, I'm just trying to get the idea wrapped around my brain

  • sending and receiving data to a CGI page from ASP .net webservice 2009-12-22

    How can I send data from my .net web service to a CGI page and collect response? It is an integration project. One side (Client A) is collecting service requests in windows application + Sql server. another side (Client B) provides the services howev

Copyright (C) dskims.com, All Rights Reserved.

processed in 0.140 (s). 11 q(s)