Delphi/FPC: Port Windows WinSock-based Socket classes to Mac

Budget $30 - $250 USD
Bids 2
Average Bid $630

Port existing Windows Sockets-based Pascal language classes library to Mac OS (Delphi or Lazarus programming environment). Need support for both TCP and UDP protocols (SOCK_STREAM/SOCK_DGRAM), blocking and non-blocking sockets; don't using Indy. Non blocking sockets should not use separate thread per each socket.

Classes to port:
//private fields/methods are omitted
------------------- >8 ----------------------------
type
//events
TIPSocketOnAccept = procedure (socket:TIPSocket);
TIPSocketOnConnecting = TIPSocketOnAccept;
TIPSocketOnRead = TIPSocketOnAccept;
TIPSocketOnConnect = TIPSocketOnAccept;

//base class for TCP/UDP sockets
TIPSocket = class
public
property Addr:sockaddr_in read GetAddr write FAddr;
property Host:string read GetHost write SetHost;
property Address:string read GetAddress write SetAddress;
property Port:integer read GetPort write SetPort;

property RemoteIP:string read GetRemoteIp;

property Error:cardinal read FError;

property Socket:TSocket read FSocket;

function NoAddr:boolean; // true if address/port is not set
constructor Create(const asynchronous:boolean = true);
destructor Destroy;override;

function EnableAsync:boolean;virtual; //enable non-blocking mode
function DisableAsync:boolean;virtual; //disable non-blocking mode

function Send(data:pointer; cb:cardinal):integer;virtual;abstract;
function Rece(data:pointer; cb:cardinal):integer;virtual;abstract;

procedure Close;

function BytesReceived:cardinal;
procedure SendReadSignal; // for non-blocking sockets sends FD_READ event to enforce reading data from the non-blocking socket.
class function GetRemoteComputerName(ip:ansistring):string; static;
class function ResolveHostName(s:ansistring):ansistring; static;
class function StrToAddr(s:ansistring):integer;static;
class function Select(nfds:Integer; readFDS, writeFDS, exceptFDS:PFDSet; timeout:PTimeVal):integer;
end;



TTCPSocket = class(TIPSocket)
private
public
property OnRead:TIPSocketOnRead read FOnRead write FOnRead;
property OnClose:TIPSocketOnRead read FOnClose write FOnClose;
constructor Create(const asynchronous:boolean = true; const basesock:TSocket = -1);
function EnableAsync:boolean;override;
function Connect:boolean;virtual;
function Send(data:pointer; cb:cardinal):integer;override;
function Rece(data:pointer; cb:cardinal):integer;override;

function SendBlock(data:pointer; cb:cardinal; const asynctimeout:integer = -1):integer;virtual; //sends long blocks (more than IO buffer size)
function ReceBlock(data:pointer; cb:cardinal; const asynctimeout:integer = -1):integer;virtual; //receives long blocks (more than IO buffer size)
end;


TTCPServerSocket = class(TTCPSocket)
private
public
property OnAccept:TIPSocketOnAccept read FOnAccept write FOnAccept;
property Error:cardinal read FError;
constructor Create(port:integer; const bindaddress:integer = INADDR_ANY; const asynchronous:boolean = true);
function Listen:integer;
function Accept:TTCPSocket;
function EnableAsync:boolean;override;
end;

TUDPSocket = class(TIPSocket)
private
public
constructor Create(const asynchronous:boolean = true);
property OnRead:TIPSocketOnRead read FOnRead write FOnRead;
function Broadcast(enable:boolean):boolean; //enables UDP Broadcast
function MulticastTTL(value:integer):boolean;
function Multicast(address:ansistring):boolean; //enables multicast for the specified address, adds itself to Multicast group
function Send(data:pointer; cb:cardinal; _toaddr:integer; _toport:word):integer;
function Rece(data:pointer; cb:cardinal; fromaddr:pinteger; fromport:pword):integer;
function EnableAsync:boolean;override;
end;

TUDPServerSocket = class(TUDPSocket)
private
public
constructor Create(port:integer; const bindaddress:integer = INADDR_ANY; const asynchronous:boolean = true);
end;

Post a Project Like This

Looking to make some money?

  • Set your budget and the time frame
  • Outline your proposal
  • Get paid for your work

Bids on this Project

  • sveralex Profile Picture

    sveralex

    Rishon Lezion,  Israel

    I possess 10+ years experience in Web and Database Development, including Delphi, PERL, LAMP, CMS, Smarty, JavaScript, AJAX, jQuery, HTML, CSS, XML, JSON. MySQL, Delphi, PHP Certified. I have a proven track record of successful projects in various programming fields, including such CMS as WordPress, OpenCart, Prestashop, Magento. Communication and Feedback's is the most important input from you. So I am available around 16-18 hours a day. I provide 24 hours supports and free revisions.

    PHP, Perl, Дизайн сайтов, and Перевод

  • ifriends710 Profile Picture

    ifriends710

    Dandong,  China

    Thank you for considering my profile. I have have been developing iOS & Android apps over 5 years. I can help you develop iOS , Android apps, Backend apis. Most of my clients have been satisfied our job results. Here is one of reviews from my clients. - “Excellent developer. Fast, responsive and super impressive results” - I've started my professional experience as C/C++ developer in 2005. During the 4 years I developed a low-level system software for Windows/Linux platforms. In early 2009 I've set my eyes onto Apple devices and started developing mobile software.I am crazy in code quality - it makes me happy when I feel I do a perfect job. Also some of my personal projects I've shared to open source community. I can lead many developers for the project too. Looking forward to working with you and good luck with your project.

    Мобильный тел., iPhone, Android, and Mac OS