# p4p **Repository Path**: quester/p4p ## Basic Information - **Project Name**: p4p - **Description**: p4p - **Primary Language**: C - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 1 - **Created**: 2014-12-08 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README p4p project 1.what's p4p? p4p is a project for p2p based network access approach library. Basically,it's very simple to use both on device and client. The communication model as following diagram. --------- ---------- |device |<---------------|client | |uid |--------------->| | --------| p4p channel |--------- In general, device is similar as a socket listening and client is simliar as a socket connect. p4p channel is a concept that data multiplexing mechanism between device and client. And the default channel is channel 0 ,so long as basic API of p4p library provided. For device,the p4p working flow: p4p_initialize(); int handle = p4p_listen(uid);//when p4p_listen() return,a client connect request accept p4p_write(handle,...); p4p_read(handle,...); p4p_close(handle); p4p_deinitialze(); For client, the p4p working flow: p4p_initialize(); int handle = p4p_connect(uid);//when p4p_connect() return,return value means connect successful or failed. p4p_write(handle,...); p4p_read(handle,...); p4p_close(handle); p4p_deinitialze(); 2.how to build p4p? For variant target platform ,many makefiles are provided. Linux Platform: Makefile Android Platform: jni/Android.mk jni/Application.mk Win32 Platform:p4p/p4p.sln 3.sample code to use p4p library See samples/* files to reference existed examples.