Ok.. so I'm trying to create a server and a client in Simba. I've done it in other languages but I wanted to make a sockets tutorial in Simba by showing how to make a chat client such as MSN for example. Unfortunately, I can't even get the basic setup working in Simba..
For some reason, it refuses to connect to even localhost :S I even tried legit addresses/ports instead of special addresses like: INADDR_ANY for the server..
Can someone tell me why it does this? I can download pages using sockets but can't connect to localhost or anything else other than websites? Also, how can I make it Async? Oh and does Simba Sockets support SSL/TLS?
Simba Code:
procedure Connect(var Socket: Integer; Port, Address: String; Listen: Boolean);
begin
Socket := CreateSocket;
if (Socket <> 0) then
begin
writeln('Failed To Initialize Socket');
terminatescript;
end;
ConnectSocket(Socket, Address, Port);
if (Listen) Then
Begin
BindSocket(Socket, Address, Port);
ListenSocket(Socket);
End;
end;
var
ClientSocket, ServerSocket: Integer;
begin
Connect(ServerSocket, '587', '127.0.0.1', true);
writeln(AcceptSocket(ServerSocket));
CloseSocket(ServerSocket);
FreeSocket(ServerSocket);
end.