Free Essay

Udp Client Server

In:

Submitted By SabarishM
Words 486
Pages 2
UDP Client and Server

The UDP client and server are created with the help of DatagramSocket and Datagram packet classes. If the UDP protocol is used at transport, then the unit of data at the transport layer is called a datagram and and not a segment. In UDP, no connection is established. It is the responsibility of an application to encapsulate data in datagrams (using Datagram classes) before sending it. If TCP is used for sending data, then the data is written directly to the socket (client or server) and reaches there as a connection exists between them. The datagram sent by the application using UDP may or may not reach the UDP receiver.

UDP client

import java.io.*; import java.net.*;

public class MyUDPClient
{
public static void main(String[] args) { try { // InetAddress class is used to getting local address InetAddress ia = InetAddress.getLocalHost(); //DatagramSocket class is used creating UDP socket DatagramSocket ds=new DatagramSocket(1236,ia); // this is message string passes to the server String y="Hell srver i am client"; //converting this string in to byte array with help of getBytes() method byte [] b=y.getBytes(); //creating DatagramPacket of byte array DatagramPacket dp =new DatagramPacket(b,b.length,ia,8); // send to the server socket ds.send(dp); System.out.println("sending String :"+(new String(b))); //b1 is a byte array is created because its use in DatagramPacket byte[] b1=new byte[50]; //now the DatagramPacket object is created with byte array DatagramPacket in = new DatagramPacket(b1,b1.length); //recieve() method of datagram socket objectis used to recive data from put in the byte array ds.receive(in); System.out.println("message from server :"+(new String(b1))); //closing the connection ds.close(); } catch(SocketException se) { System.out.println(se); } catch(Exception e) { System.out.println(e); } }
}

UDP Server code

import java.io.*; import java.net.*;

public class MyUDPServer { public static void main(String[] args) { try{ //creating a UDP socket(datagramsocket) class object where 8 is port number DatagramSocket ds=new DatagramSocket(8); //b1 is a byte array is created because its use in DatagramPacket byte[] b1=new byte[50]; //now the DatagramPacket object is created with byte array DatagramPacket in = new DatagramPacket(b1,b1.length); //recieve() method of datagram socket objectis used to recive data from put in the byte array ds.receive(in); System.out.println("recieving String :"+(new String(b1))); String y="Hello client i am server"; byte [] b=y.getBytes(); DatagramPacket out =new DatagramPacket(b,b.length,in.getAddress(),in.getPort()); // send method of DatagramPacket is used to sending the data to client socket ds.send(out); ds.close(); } catch(SocketException se) { System.out.println(se); } catch(Exception e) { System.out.println(e); } }
}

OUTPUT

First run the server program; than you can see it wait for client addresses.

Now run the client program; then you will get the following output.

The server will show the message sent by the client.

Similar Documents

Free Essay

Is3220 Week 7

...IS3220 VPN connectivity troubleshooting checklist 1. Users can't access file servers If the user can access the file server using an IP address but not a name, then the most likely reason for failure to connect is a name resolution problem. Name resolution can fail for NetBIOS or DNS host names. If the client operating system is NetBIOS dependent, the VPN clients should be assigned a WINS server address by the VPN server. If the client operating system uses DNS preferentially, VPN clients should be assigned an internal DNS server that can resolve internal network host names. When using DNS to resolve internal network host names for VPN clients, make sure that these clients are able to correctly resolve unqualified fully qualified domain names used on the corporate network. This problem is seen most often when non-domain computers attempt to use DNS to resolve server names on the internal network behind the VPN server. 2. Users can't access anything on the corporate network Sometimes users will be able to connect to the remote access VPN server but are unable to connect to any resources on the corporate network. They are unable to resolve host names and unable to even ping resources on the corporate network. The most common reason for this problem is that users are connected to a network on the same network ID as the corporate network located behind the VPN server. For example, the user is connected to a hotel broadband network and is assigned a private...

Words: 1569 - Pages: 7

Free Essay

Week 7 Lab

...Service (RADIUS) is a networking protocol that provides centralized Authentication, Authorization, and Accounting (AAA) management for users that connect and use a network service. RADIUS was developed by Livingston Enterprises, Inc. in 1991 as an access server authentication and accounting protocol and later brought into the Internet Engineering Task Force (IETF) standards. Because of the broad support and the ubiquitous nature of the RADIUS protocol, it is often used by ISPs and enterprises to manage access to the Internet or internal networks, wireless networks, and integrated e-mail services. These networks may incorporate modems, DSL, access points, VPNs, network ports, web servers, etc. RADIUS is a client/server protocol that runs in the application layer, using UDP as transport. The Remote Access Server, the Virtual Private Network server, the Network switch with port-based authentication, and the Network Access Server (NAS), are all gateways that control access to the network, and all have a RADIUS client component that communicates with the RADIUS server. RADIUS is often the backend of choice for 802.1X authentication as well. The RADIUS server is usually a background process running on a UNIX or Microsoft Windows server. Diameter is an authentication, authorization, and accounting protocol for computer networks. It evolved from and replaces the much less capable RADIUS protocol that preceded it. Diameter Applications extend the base protocol by adding new commands...

Words: 669 - Pages: 3

Free Essay

Silver

...forth. It also allows PCs to create a server as a means of communication. 3. Describe some of the disadvantages of networking computers * Some of the disadvantages of networking computers is that it spreads viruses across the network and things like network failure, disable the users of the server abilities to do work. Also, problems like slow service and unavoidable cost make networking computers seem kind of unappealing. 4. Describe a LAN * A LAN is when computers are fairly close to one another, in a single office or two buildings that are separated by a road, they can be joined together either by cables or wireless means. 5. Describe a WAN * A WAN is basically the same as a LAN, however spread over a large area. 6. Explain what is meant by peer-to-peer network * Where two or more computers are connected together without needing a file server to be part of the network. 7. Identify the advantages and disadvantages of a peer-to-peer network * The advantage is that it is much easier to set up than a client-server network and it also does not need specialist knowledge. The disadvantage is that ensuring viruses are not introduced to the network is the responsibility of each individual user. 8. Explain what is meant by a client-server network * A client-server network is a type of network that receives information from the host server. 9. Identify the advantages and disadvantages of a client-server network * Advantages include;...

Words: 512 - Pages: 3

Free Essay

Sccm

...Installing the SCCM 2012 client for Windows This article details the supported ways of installing the SCCM 2012 client for Windows. ------------------------------------------------- Before You Begin You must install the SCCM 2012 client on computers you want to manage with SCCM 2012. ------------------------------------------------- Client Installation Methods The supported installation methods at Illinois State University include the following: * Client Push - The client can deployed from the SCCM server to computers automatically discovered in Active Directory. This is the recommended installation method. * Manual - The client can be manually installed onto computers. ------------------------------------------------- Client Requirements SCCM 2012 at Illinois State supports the following: * Windows XP with SP3 * Windows Vista with SP2 * Windows 7 A list of all supported operating systems can be found in the Computer Client Requirements Microsoft TechNet documentation. ------------------------------------------------- Client Push Installation (Recommended) The SCCM 2012 server can be configured to discover computer accounts in Active Directory and allows SCCM administrations to push client installations from the SCCM console. The client can be pushed to a single computer or to an entire collection of computers from the SCCM 2012 console. ------------------------------------------------- Client Push Prerequisites The following prerequisites...

Words: 797 - Pages: 4

Free Essay

Spcc

...Table of Contents 1. Acknowledgement 3 2. Introduction 4 2.1 Smart Home Control System 4 2.2 LabVIEW 5 3. Project Requirement 6 3.1 Project Requirement fulfilled by using LabVIEW 6 3.2 Why should I Use LabVIEW? 7 3.3 How does LabVIEW work? 8 3.3.1 Front Panel 8 3.3.2 Block Diagram 9 3.3.3 Icon 9 4. System Analysis 10 4.1 Flow Chart – Client 10 4.2 Flow Chart – Server 11 4.3 Floor Plan 12 5. Protocol Design 13 5.1 The Internet and Client-Server Model 13 14 5.2 Using TCP/IP with LabVIEW 15 5.3 Control Interface - Client Connection 16 5.3.1 TCP Open Connection 16 5.3.2 TCP Write 16 5.4 Indicator Interface - Server Connection 17 5.4.1 TCP Listen VI 17 5.4.2 TCP Read 17 6.4.3 TCP Close Connection 18 5.4.4 Clear Error VI 18 6. Hardware Research 19 7. Extra Features 22 7.1 Alarm 22 7.2 Smart Control 23 7.3 Multiple User Login 23 7.4 Master Control 24 8. Assumption 25 9. Limitation 26 10. Future Enhancement 27 11. Conclusion 28 12. References 29 13. Appendix 31 13.1 User Manual 31 13.2 Class Work Program 37 13.2.1 Television 37 1. Acknowledgement First and foremost, I would like to express my deepest gratitude to everyone that made it possible for me to complete this System Programming and Computer Control (SPCC) assignment. This assignment was one of the most challenging task for me but putting in massive amount of determination, awareness and perseverance eventually helped me to excel and complete...

Words: 5590 - Pages: 23

Free Essay

Performance Tuning for Windows Server 2008

...Performance Tuning Guidelines for Windows Server 2012 April 12, 2013 Abstract This guide describes important tuning parameters and settings that you can adjust to improve the performance and energy efficiency of the Windows Server 2012 operating system. It describes each setting and its potential effect to help you make an informed decision about its relevance to your system, workload, and performance goals. The guide is for information technology (IT) professionals and system administrators who need to tune the performance of a server that is running Windows Server 2012. For the most current version of this guide, see Performance Tuning Guidelines for Windows Server 2012. ------------------------------------------------- Disclaimer: This document is provided “as-is”. Information and views expressed in this document, including URL and other Internet website references, may change without notice. Some information relates to pre-released product which may be substantially modified before it’s commercially released. Microsoft makes no warranties, express or implied, with respect to the information provided here. You bear the risk of using it. ------------------------------------------------- Some examples depicted herein are provided for illustration only and are fictitious. No real association or connection is intended or should be inferred. ------------------------------------------------- This document does not provide you with any legal rights to any intellectual...

Words: 50142 - Pages: 201

Free Essay

Financial Analyst

...and Problem Management skills. PeopleSoft Administrator, Oracle Database, LINUX, UNIX skills have enabled me to perform multiple installations, upgrades, performance tuning, and troubleshooting the infrastructure components required to establish and maintain the PeopleSoft PIA Architecture. PeopleSoft Server Administration – Installed and configured PeopleTools, File Server, Application Server, Process Scheduler Server, Tuxedo, WebLogic Web Server, PeopleSoft Internet Architecture (PIA) and Report Distribution, Load Balancing, Failover, Integration Broker, Single Signon, LDAP, Environment Management Framework, PeopleSoft Application Security Administration, Disaster Recovery, Business Continuity Planning for various PeopleSoft Oracle Database Instances. Expertise in performing routine maintenance activities - Environment Refreshes, PS Project Migration, File Object Migration, Performance Tuning of Web Server, Application Server, Tuxedo, Process Scheduler Server and Database, PeopleSoft Application Security. Successfully applied PeopleTools Product Patches, Application Patches, Bundles, Maintenance Packs, and PeopleTools Upgrades. Trouble shoot problems related to Server Components and Failed Process or Jobs, Performance Tuning, Turning on Traces, Working closely with Developers, QA Team and End users. Worked on distributed, large-scale and high availability environments and full cycle implementations of PeopleSoft Systems. Comprehensive experience working with diverse...

Words: 1065 - Pages: 5

Free Essay

Executive Summary

...Associates and Belleview Law Group. The current network at Myrtle & Associates consists of three servers, a domain controller, a file server, and an application server. They also have a wireless network for their paralegals, and attorneys. This will allow them to access the network from their laptops and from their smartphones. Belleview Law has a legacy network that needs some upgrading. Their network consists of four servers, a Novell directory server, a file server and two legacy management servers. There is no wireless serves for their paralegals and attorneys. My plan is to bring the two networks together in a way that will save money and provide a more efficient way to access information on the network. As it stands there are two problems that need to be addressed. The first issue is that Belleview’s network has a Novell Directory server whereas Myrtle & Associates has a domain controller. The other issue is Belleview’s network has two legacy management servers. These two issues will make migrating data a little challenging. The new network will be a bus star topology. This will help with redundancy and it will have a wireless access point. My first plan will be to transfer the Novell directory server data to the Windows domain controller. I will then combine the two file servers. Lastly I will add a management server that will eliminate the two legacy servers. Thanks Tyree Hawkins Network...

Words: 266 - Pages: 2

Free Essay

Riordan Manufacturing Hr System Part 2

...application architecture describes the layout of the application deployment, generally includes partitioned application logic and deployment to application server engines (Gartner, 2013). The application architecture can be tailored to any business. Riordan Manufacturing must define objectives prior to choosing and designing their system. Once the objectives have been identify then the design process can start. With the equipment needs, implementation requirements, and workflow clearly understood these are describe in more detail in order to design the appropriate system. The designing itself is accomplished after many interviews in order to capture the real needs, by using flowcharts, scale models, and even some process simulation software (Dennis, Wixom, & Ruth, 2012). A client server architecture services would be beneficial for Riordan being that this nonfunctional requirement could have more benefits than a server based or client server. There are four major benefits in a client server; scalability, adaptable support, reliable networking and separation of logic: a) Scalability adjusts storage and processing within the server b) Adaptable support is the ability to support different client and servers. The server can also separate logic’s without changing any other data. c) Reliable networking allows the server to maintain the network in case of any errors or application crashes d) Separation of logic facilitates reasoning (Dennis, Wixom, & Ruth, 2012) ...

Words: 797 - Pages: 4

Free Essay

Network Consultant Scenerios

... Complete Case Projects 3-1, 3-2, & 3-3 of Guide to Networking Essentials. After determining if a client-based or client/server model will be used, substantively justify your choice in 200 to 300 words. Case Project 3-1 The changes in equipment that are required to bring this company’s network up to date to solve the shared bandwidth problem is replacing the hubs with fast ethernet switches and a router. You could make subnets for each department of the company, creating different collision domains which would eliminate dropped packets. The throughput would be increased based upon the upgraded switch/router. Also Setup a file server to store the large files. I would the issue of this problem by using a mesh topology and run over 300Ft of Cat 5 cable to a single point. You could also run the cable through metal conduits along walls or on the floor or you could always implement a wireless system to solve the ceiling issue. Case Project 3-2 The topology that should be used in this network is an extended star topology because it is a bit more advanced than the regular star topology. Instead of connecting all devices to a central unit, sub-central devices are added in. This allows more functionality for organization. The Extended Star Topology is all but necessary to prevent degraded signals and it is also better for bigger networks. Also the network would be server based because connection will be coming from one central point for all computers allowing for information...

Words: 472 - Pages: 2

Premium Essay

Technical Writing

...References 3 Appendix 1: Competency Matrix 4 Appendix 2: 5 Appendix 3: 6 Capstone Proposal Summary The ClientABC has outgrown their existing file server environment, and is looking for a content management system with analytical capabilities. They have provided us with detailed requirements, and we have recommended the implementation of a Microsoft® SharePoint portal leveraging Microsoft® SQL Server for a Business Intelligence solution. The portal will only be required to be accessible from within the organization and not externally. This platform will address the specific needs of each department by allowing users to upload and share department documents, such as polices. The IT department will work with other department managers to develop custom workflows based on their business processes needs. The Administration group will help define the analytical dashboard and reporting needs of the organization, with the focus on ensuring management buy-in. The knowledge management team will work us to implement the solution. The infrastructure department will be responsible for providing a robust and scalable infrastructure, through the use of their VM Ware servers. The recommended infrastructure of eight to ten virtual server will include four (4) to six (6) Web Front End virtual servers running...

Words: 1566 - Pages: 7

Free Essay

Information Systems in Business

...daily information that is produced by the company and separate it into a form showing the averages and the declines that are being made so they can adjust their production to meet a specific goal. They also are able to streamline businesses and lowering production cost by implementing a more reliable system of data collecting. While working for a University in Germany they used many different types of systems to do separate projects and handle different functions like we had an email server just to handle all of the staff and students email requests. We had a database server to handle all of the data for the courses Europe that was tied in to other servers in Asia and the USA. We had a small mainframe with virtual servers to handle the school business functions like HR, IT and many of the other day to day functions of the University along with access to its stateside counterpart for online classes. There was a print server to handle the printing responsibility and there was a file server to handle...

Words: 976 - Pages: 4

Premium Essay

Deals R Us

...The first alternative will have a special tool developed in C++ that clients will download onto their computers to run. The tool will communicate with the DRUB server to select data to analyze.  – This alternative would be client based architecture. The client gives the command to the server. 2. Alternative Two: The second alternative will have the C++ program running on the server; the client will use his or her browser to interact with the server. – This alternative would be two tier thin client server architecture. This requires a web browser, a server and application layer. B) Outline the pros and cons of the two alternatives and make a recommendation to Fred about which is better. Alternative One – Client Based Architecture. Pros: 1. This is an affordable alternative since microcomputers are cheaper than mainframes and it does not take long periods to implement. 2. On a client based architecture, varying hardware manufacturers can cross function. Cons: 1. All data on the server must travel to the client for processing; this can lead to an overload of the circuits on the network since far more data than is needed is usually transmitted. Alternative Two – Two Tier Thin Client Server Architecture Pros: 1. There is a balance of processing since both the server and the client do the same processing making the system an efficient one. 2. Cross functioning is able on client server architecture, so that different software and hardware from different...

Words: 355 - Pages: 2

Free Essay

Network Security

...Peer-to-Peer and Client/server Networks Professor: Karen Lederer Trevor Kale 4/16/2011 We shall discuess the difference between Peer-to-Peer networks and the Client/Server networks. First we need to describe how each one operates in order to view the differences between both. First we will describe a Peer-to-Peer network. In the Peer-to-Peer network every computer can communicate directly with every other computer.(2009, Dean, Pg.3) Because of this setup no one computer has more authority then another one on the network. Each person on the network can set their access and restrictions for other users to their computer. These configurations are simple to configure and due to the simplisity they do not require a great technical expertise. They also tend to be cheaper due to lack of need of equipment to establish this network. Some disadvantages consist of not being flexible, that is as they grow they become more difficult to handle. Security on these networks is very lacking due to ease of access of unauthorized access. They are also not very practical due to the lack of centralized resources requires a user to have their terminal on in order to access their resources. That is the basics of a Peer-to-Peer network setup, next we move on to the Client/Server model. In a Client/Server network a centralized computer known as a server facilitates communication between other computers on the network known as clients. For a computer to function as a server they must be running...

Words: 478 - Pages: 2

Free Essay

The Benefits of Twisted Pair Cable

...currently has 20 Windows peer to peer client computers I would like for you to consider moving towards the client server network modelOnce a peer-to-peer network grows beyond 10 computers, it will likely begin to suffer from performance and from administrative problems (Posey, 2000) In the client server network model network hosts have specific roles which are assigned to them. There are certain host that are assigned as servers, which will provide network resources to the workstations. Unlike the current peer to peer model that is supported in your organization today in which everyone workstation has the same or similar operating systems. There are several benefits for your organization to consider to transitioning to client server network model. One of the major benefits of the client server network model is scalability. Since we know the potential for this organization to double in size over the next two years scalability is a key factor. It’s very easy to expand the size of your network with client server model because it will be easy to just add on workstation. Everything is centralized to the server. This server will be the centralized platform for all the workstations. Another major benefit of this client server model is increased security. This server will provide security that Ocper, Inc. current peer to peer model lacks. This server is responsible for the security surrounding the shared resource. In the client server environment you can set the appropriate...

Words: 719 - Pages: 3