Petabytes of TCP/IP Programming

Source: Internet
Author: User

Petabytes of TCP/IP Programming
Http://hi.baidu.com/pwzh/blog/item/f690c235f116f31391ef39db.html

Now the multi-layer model is popular instead of the C/S model, and the three-layer model structure can be realized through the proxy object in Pb.

System. Client-> Application Server-> backend database.

Putting Enterprise Business Rules into application server can not only reduce the complexity of maintenance, but also benefit

Unified Business Rule changes reduce the trouble of system upgrade after the previous business rules of the C/S system are changed.

An excellent application server interface is designed. Basically, changing business rules does not need to change the client.
,

This is why people propose a multi-layer model.

The following is a programming test program for Pb TCP/IP using the Winsock driver.

Discussion.

 

(1). Server Side
1). w_main window open event script

Transport li_port
Li_port = create transport
Li_port.application = "8888" // TCP port number
Li_port.location = "192.168.0.1" // ip address
Li_port.driver = "Winsock" // use the Winsock driver
Li_port.listen ()
If li_port.errcode <> 0 then

MessageBox ("jmserver", "Startup Error !!! ")
MessageBox ("Err", li_port.errtext)
End if

2). app user object

App user object functions
String Hello ()
{Return "OK "}
3) use the project to generate the proxy object app and put it in proxy. PBL.

(2). Client

1). Add proxy. PBL to the application library path.
2). Test the button clicked event script
Connection my_connection
APP my_server1

My_connection = create connection
My_server1 = create app
My_connection.application = "8888" // TCP port number
My_connection.location = "192.168.0.1" // ip address
My_connection.trace = "log = D:/test_pb/err. Log, objectcils = 1,
Objectlife = 1"
My_connection.driver = "Winsock" // use the Winsock driver
If my_connection.connecttoserver () <> 0 then
MessageBox ("client", "errorcode =" + String (my_connection.errcode) + &
"~ R ~ Nerrortext = "+ my_connection.errtext)
Halt close
End if
My_connection.createinstance (my_server1)
MessageBox ("result", my_server1.hello ("") // call the server user object
App
// Hello Function
The layer-3 Model in Pb basically uses this method to generate a proxy object
The object calls the functions in the application server on the server. The application server on the server is the intermediate layer
The three-tier model programming of Pb is implemented. The advantage of Pb proxy object is to encapsulate the complexity of socket programming,
Simple development of Pb-level model systems.
 
 

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.