NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io


Conversation opened. 1 read message.

Skip to content
Using Gmail with screen readers

3 of 945
Mula saag
Inbox
x
Nom Rana <[email protected]>
Attachments
Sat, Apr 13, 2:45 PM (2 days ago)
to me

Be careful with this message
Nom Rana has never sent you messages using this email address. Avoid replying to this email unless you reach out to the sender by other means to ensure that this email address is legitimate.

Report phishingLooks safe
Attachments area
Not connected. Connecting in 2:55…
Try now

package com.example.myapplication4;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.text.method.ScrollingMovementMethod;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

import java.io.IOException;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;
import java.net.SocketException;
import java.net.UnknownHostException;

public class MainActivity extends AppCompatActivity
{
DatagramSocket socket;

TextView t;
EditText e;
Button b;

class SocketListener implements Runnable
{
String str;

public void run()
{
DatagramPacket packet;
byte[] buf = new byte[256];

try
{
while (true)
{
packet = new DatagramPacket(buf, buf.length);
socket.receive(packet);
String s = new String(packet.getData());

CharSequence cs = t.getText();
str = cs + "J> " + s + "n";

t.post(new Runnable()
{
public void run()
{
t.setText(str);
}
}
);
}
}
catch (IOException e)
{
Log.e(getClass().getName(), e.getMessage());
}
}
}

@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

try
{
socket = new DatagramSocket();
}
catch (SocketException e1) {}

e = (EditText) findViewById(R.id.editText);

t = (TextView) findViewById(R.id.textView);
t.setMovementMethod(new ScrollingMovementMethod());

Button b = (Button) findViewById(R.id.button);
b.setOnClickListener(new View.OnClickListener()
{
public void onClick(View v) {
String s = e.getText().toString();
t.setText(t.getText() + "A> " + s + "rn");

try {
byte[] buf = new byte[256];
buf = s.getBytes();

InetAddress address = InetAddress.getByName("192.168.0.106"); // Change this to the IP address of your computer OR “10.0.2.2”(Gateway to 127.0.0.1 of host)
final DatagramPacket packet = new DatagramPacket(buf, buf.length, address, 2222);

new Thread() {
public void run() {
try {
socket.send(packet);
} catch (IOException e1) {
e1.printStackTrace();
}
}
}.start();
} catch (UnknownHostException e2) {

}
}
});

Thread t = new Thread (new SocketListener ());
t.start();
}
}
new 3.txt
Displaying new 3.txt.
     
 
what is notes.io
 

Notes is a web-based application for online taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000+ notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 14 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.