DefaultMinaUDPSocketConnector
1…………………………………………..
// Java program to illustrate Client side
// Implementation using DatagramSocket
import java.io.IOException;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;
import java.util.Scanner;
public class udpBaseClient_2
{
public static void main(String args[]) throws IOException
{
Scanner sc = new Scanner(System.in);
// Step 1:Create the socket object for
// carrying the data.
DatagramSocket ds = new DatagramSocket();
InetAddress ip = InetAddress.getLocalHost();
byte buf[] = null;
// loop while user not enters "bye"
while (true)
{
String inp = sc.nextLine();
// convert the String input into the byte array.
buf = inp.getBytes();
// Step 2 : Create the datagramPacket for sending
// the data.
DatagramPacket DpSend =
new DatagramPacket(buf, buf.length, ip, 1234);
// Step 3 : invoke the send call to actually send
// the data.
ds.send(DpSend);
// break the loop if user enters "bye"
if (inp.equals("bye"))
break;
}
}
}
Server qismi
// Java program to illustrate Client side
// Implementation using DatagramSocket
import java.io.IOException;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;
import java.util.Scanner;
public class udpBaseClient_2
{
public static void main(String args[]) throws IOException
{
Scanner sc = new Scanner(System.in);
// Step 1:Create the socket object for
// carrying the data.
DatagramSocket ds = new DatagramSocket();
InetAddress ip = InetAddress.getLocalHost();
byte buf[] = null;
// loop while user not enters "bye"
while (true)
{
String inp = sc.nextLine();
// convert the String input into the byte array.
buf = inp.getBytes();
// Step 2 : Create the datagramPacket for sending
// the data.
DatagramPacket DpSend =
new DatagramPacket(buf, buf.length, ip, 1234);
// Step 3 : invoke the send call to actually send
// the data.
ds.send(DpSend);
// break the loop if user enters "bye"
if (inp.equals("bye"))
break;
}
}
}
Dastur natijasi::
Xulosa
Men Tarmoqni dasturlash asoslari fanindan mustaqil ish bajarish jarayonida udp(UDP protokoli asosida audio konferensiya dasturiy
ta’minotini yaratish) to’g’risida ma’lumotlarga ega bo’ldim va shu protokol foydalangan holda nodejs dasturlash muhiti yordamida UDP protokoli asosida tarmoq dasturini tuzdim. O’zimga kerakli bo’lgan bilim va ko’nikmalarga ega bo’ldim
Foydalanilgan adabiyotlar
https://nodemailer.com/about/
https://ru.wikipedia.org/wiki/SMTP
Dostları ilə paylaş: |