HTTP Response (responses)
Like the request, an HTTP response also contains three parts:
Protocol Status Code description (Protocol-status code-description)Response header (Response headers)Entity (Entity body)The following is a simple example of an
ServerSocket class
The socket class represents the client's socket. Whenever you want to connect to a remote server application, you have to build a socket. If you want to perform a server application, such as an HTTP service or an FTP service, you
In the following paragraphs, let's take a look at these three classes.
Httpserver class
The Httpserver class represents a Web server and can be serviced for those static resources found in the public static directory Web_root and its
input = Socket.getinputstream ();Output = Socket.getoutputstream ();Await then creates a request object and invokes its parse method to parse the original HTTP request information. Create Request object and parseRequest Request = new request (input);
Chat Room | Problem This chat room is written in Java, part of the source code is such, but debugging can not run, but also please heroes pointing: import Java.awt.event.*;import java.net.*;import java.io.*; Import Java.util.*;import
Notes
Chapter 13th creating Windows and Programs
Slightly
14th Chapter Multithreading
There are basically 2 ways to implement Multithreading: Inherit from the thread class and implement the Runnable interface
1. The easiest way to inherit from a
The server side of a very simple LAN chat tool
/*
* Created on 2005-3-18
*
* TODO to change the template of this generated file go
* Window-preferences-java-code Style-code Templates
*/
Package netchat;
Import javax.swing.*;
Import
Program | port scan how to scan the local and remote port of computer system, monitor whether it is turned on or off in many applications, the following is a simple port scanner implemented in Java.
Source Code:
----------------------------------
6.2 Client Program 1-Connect to ServerOur first MySQL client program is simple: Connect to the server, disconnect, and exit. It's not very useful in itself, but you must know how to do it, because actually doing anything with a MySQL database must
server| Resolution | How the problem resolves connection problems in SQL Server 2000 apply to important notes: This article contains information about modifying the registry. Be sure to back up the registry before you modify the registry, and be
When IIS is building a WAP platform, because the WAP platform is compiled with MySQL, Tomcat, and Apache in Linux, the server environment I can provide can only be Win2003 server, IIS6, So looking for a iis6 with TOMCAT5 integration of the article,
Programming Java platform in the java.net package to implement the socket. In this article, we will work with the following three classes in the java.net package: · URLConnection Socket ServerSocket contains more classes in the java.net package,
Note One MIDP communication technology
1. HTTP:
when the real phone in the network is configured for HTTP streaming midlet, do not try to send only one small piece of data at a time: you will not receive anything until you have finished
c++| problem in recent days to see the csdn to ask C + + and Java communication problems are more, especially the C-specific data structures (such as struct).
Specially according to a netizen's question to give an example, hoped has the help to the
c++| question This part proposes another method for the reference.
Import java.net.*;
Import java.io.*;
/**
* Communicate with C language (Java do client,c/c++ do server, send a structure)
* @author Kingfish
* @version 1.0
*/
public class
Clientapp.java original file to implement client-side functionality:
Import java.net.*;
Import java.io.*;
Import java.lang.*;
public class ClientApp
{
public static void Main (String args[])
{
Try
{
Create communications and connect to the host
The connected attribute of the network socket class often cannot determine the network connection accurately, the following code can solve this problem
Whether you have connected
Public virtual BOOL Connected
{
Get
{
Try
{
Check the state of the
Web/**
FileName: Firstsocket.java
Description: Accesses a Web page through the Java.net.Socket class and returns the result
Author: Ci Qin Qiang cqq1978@yeah.net
Reference: http://java.sun.com
**/
Import java.io.*;
Import java.net.*;
public class
Network//Tcpserver.java by Fpont 3/2000
//Usage:java tcpserver //default port is 1500.
//connection to is closed by client.
//This server handles only 1 connection.
import java.net.*;
import java.io.*;
public class TCPServer {
public
Programming server Sockets
List 9.2 is part of a server application.
List 9.2 A simple server program
/**
* A program that listens on ports and provides HTML documents.
*/
class Simplewebserver {
public static void Main (String args[]
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service