GithubHelp home page GithubHelp logo

2015-ezsocketcore_api's Introduction

NCU NWLab socket programming homework

Author:史碩三

Welcome to the demo webside of sam33's EZSocketCore library EZWeb component

sam33's EZSocketCore library : Github

-----------------------------------------------------------------------------------------------------------
這次的socket programming作業,我的主題是一個簡易的跨平台socket api
主要提供三個模型,其一為簡易的多工Server,二為簡易的Client,三為簡易的WebServer
並使用此api的三個模型功能各自撰寫了一個example來Demo
但是目前WebServer模型在Windows上貌似有各種問題,主要是因為採用Windows的CreateThread代替fork的關係
之後會想辦法解決,目前衍生的問題為在Windows上採用此模型撰寫的WebServer程式,在瀏覽時,IE瀏覽器上會無回應
而Chrome瀏覽器有時會有回應,有時無回應.
在Linux系統或Mac上使用此模型撰寫及編譯出來的WebServer程式則無此問題

此api透過一些封裝,讓使用者能夠過c語言簡易地撰寫具有多工功能的簡易伺服器端以及簡易客戶端
另外,此api也封裝了部分的HTTP1.0伺服器功能,能夠讓使用者快速設計一個具有網頁服務功能的伺服器端

Demo程式分為兩類,一為簡單的DateTime伺服器以及客戶端
二為簡易的網頁服務伺服器,就是您現在正在使用的這個功能

-----------------------------------------------------------------------------------------------------------
編譯指令:
make        編譯所有的Example
make all    編譯所有的Example
make ex1    只編譯Example1_Timeserver
make ex2    只編譯Example2_Timeclient
make ex3    只編譯Example3_Webserver
make clean  清除所有編譯結果

執行: Example1_Timeserver: /* 在本機的port 9999執行 / ./Timeserver / 在本機的port X執行 */ ./Timeserver X

Example2_Timeclient: 1.先啟動Timeserver 2.啟動Timeclient /* 連接到本機port 9999的Timeserver / ./Timeserver / 連接到ip為xxx.xxx.xxx.xxx,port為Y的Timeserver */ ./Timeclient xxx.xxx.xxx.xxx Y Example: ./Timeclient 192.168.1.100 9999

Example3_Webserver:(佔用port 9999,可自行修改source code) 1.先啟動Webserver於本機(假設ip為xxx.xxx.xxx.xxx) ./Webserver 2.開啟任意瀏覽器,於網址列輸入http://xxx.xxx.xxx.xxx:9999/ 注意:目前在Windows上執行WebServer的話瀏覽器看到會有些問題,建議在linux或Mac上執行WebServer


-----------------------------------------------------------------------------------------------------------

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.