Link to home
Start Free TrialLog in
Avatar of lortega
lortega

asked on

Client / Server without NT


I want to know how to implement an Client / Server application without NT, thats mean no use of pipe, ndde, any kind of database (MsSQL), or Winsock because they need an NT system...

please not mailslot because they are not secure...

If you know some window's protocol (APIs) or somes good comunication libraries, let me know...

note: I'm using Delphi Developer but if is necesary I can make the implementation from C/C++
Avatar of Tommy Hui
Tommy Hui

You can use Winsock on Windows 3.11 and Win95 as well as NT.
Avatar of lortega

ASKER

I know that you can develop CLIENT programs in 3.11, WFW, Win95, WinNT35, and WinNT4 but you need an server running on the network, thats I dont want it...

I need an protocol or API or something that let me create 2 programs an server (but trunning on Win95) and one clients running on Win95...

the issue is that...

Pipe, NDDE or Winsock server side must be on an NT system...

I don't want an NT on a network...
Avatar of lortega

ASKER

I know that you can develop CLIENT programs in 3.11, WFW, Win95, WinNT35, and WinNT4 but you need an server running on the network, thats I dont want it...

I need an protocol or API or something that let me create 2 programs an server (but trunning on Win95) and one clients running on Win95...

the issue is that...

Pipe, NDDE or Winsock server side must be on an NT system...

I don't want an NT on a network...
Comment following explaing what you have to do...
Follow the same procedures you would follow to create a client application : Initialize Winsock with WSAStartup , and create a socket with socket()

2nd : Bind the socket on the port you want to create the server . You can  use the sockaddr_in structure to do that , and the bind() function

3rd : Call listen() , which prepares the socket to accept functions .

4th : Call accept() , and you get a socket able to manage transfers . Note that accept() will not return immediately if there is no waiting connection and the socket is blocking - Try WSAAsyncSelect() with FD_ACCEPT , for your window to have a message when the socket is ready to accept connections with accept()
If you need more help , just ask :)
Avatar of lortega

ASKER

to Bind the socket on the port, I need a server port... I dont want that...

this is my case:

     a.  5 or 6 machine running an Win 95 network, NOT ANY KIND OF SERVER!
     b.  I need to make an program that run on one machine polling information from com port and send information across the network without use file system...
     c.  No server... there should be one kind of protocols because Win 95 comunicate to share som devices like printers and folders without the use of any server...

note: I already have the program that poll information from the com port, now I need to send that information (posible reformated) across the network thru other program that just receive and display information...
I hate to repeat everyone else, but you CAN use WINSOCK on any machine to serve up a port.  The machine can be running Win31, 95, or NT.  This machine opens up the port and listens on it, as described by WxW.  Any other machine can then open up a port to the first machine and communicate with it.

So is there another problem we're missing?  Does the polling machine not know who is going to be displaying the data?  
Iortega , do not confuse the "Windows NT Server" with a "Server Application" . There are some programs designed for Win 95 to be "Servers" , like the Ms Personal Web Server , or SERV-U for FTP

Whoops sorry , that was a comment :)
Avatar of lortega

ASKER

How can I call GetHostByName or GetHostByAddress if I dont have any Host (server) ?
How can I fill sockaddr struct without an server address?

If you have some simple TCP/IP list that run like an server in Win 95, and other that work like an client in Win 95 without any server use, I will duplicate or triplicate the points of this answer...
Avatar of lortega

ASKER

Ms Personal Web Server , or SERV-U for FTP  work when you are connected to the internet???

if this is true, then you are using a server... the one that you use to connect thru internet...
Avatar of lortega

ASKER

Ms Personal Web Server , or SERV-U for FTP  work when you are connected to the internet???

if this is true, then you are using a server... the one that you use to connect thru internet...
Avatar of lortega

ASKER

Ms Personal Web Server , or SERV-U for FTP  work when you are connected to the internet???

if this is true, then you are using a server... the one that you use to connect thru internet...
Simply call gethostname() . This returns the name of the machine . Then you call gethostbyname() and you get the IP address . Also , you do not need to fill the sin_addr.s_addr member of a sockaddr_in , just use INADDR_ANY . That orders Windows to choose any valid network address for the socket
Dear Iortega, the answer you are looking for has been given already, now we gust have to clear some misconceptions you apparently have. It seems like you mix the terms Server, Host, MS Win NT Server and a couple more. Here are my definitiuons:

Host: any computer connected to the Internet (no matter what OS it is using)

Server: an APPLICATION running on a computer waiting for other application to come and be SERVED. A server application can run on any OS as long as OS supports some kind of "hole" accepting incoming connections. Win 95 support such "hole" via WinSock. An example of server is FTP Server that listens to FTP commands and serves up files.

Win NT Server: an operating system from MS, offers some exotic ways to build server applications (such as named pipes) Otherwise, just another OS

People often call the computer running server application "a Server" This is just a short form of "A computer mostly reserved for server applications"

You are correct when you say that GetHostByName requires a server. However, the needed server is a DNS server which you normally have when you connect to the Internet. Even if you do not have it, local machine names will still be accessible from NetBios over IP implementation.

Anyway, stop worrying and begin coding. Sockets will work for you.
Avatar of lortega

ASKER

some have some usefull code! (preferebly Delphi or C) not MFC
ASKER CERTIFIED SOLUTION
Avatar of WxW
WxW

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of lortega

ASKER

When I am connected to the internet
           I get addres 200.17.68.0

When Iam not I get
           Error 11004!
Your LAN address is 127.0.0.1 . You can use it all the times . Probably you have not installed Winsock 2+ thats why when in lan the gethostbyname() does not return it - How ever , you can use it
Avatar of lortega

ASKER

Winsock 2 is available for Win95 ?
Avatar of lortega

ASKER

How did you get  127.0.0.1 as LAN Address?
Avatar of lortega

ASKER

How did you get  127.0.0.1 as LAN Address?
gethostname() returns the computer name , the same entered in the control panel -> Network . By performing a gethostbyname() using this name , you get an IP address . If you are connected , the hostent structure is filled with the normal IP address 200.67.18.0 for example . If you are not connected , WinSock 1.x returns NULL , but Winsock 2+ returns the 127.0.0.x . The basic loopback address is 127.0.0.0 , and you can use 127.0.0.1 , 127.0.0.2 etc . Even if winsock does not return an address , you can assume that 127.0.0.1 can be used .
Avatar of lortega

ASKER

Now, when I start my server-appl gethost return 188.12.156.0, if I verify in network configuration thare are no IP (its set to Optain IP Address Auto...) if I change that and put any IP, however i receive the same IP (188.12.156.0) but I can't connect to Internet...

When the client-appl run, it can connect to 127.XXX.XXX.XX but cannot connect to IP 188.12.156.0 or the other IP that I manualy assign...   Why?
Setting off "Obtaining IP address automatically" and specifying a new IP , has a meaning only if your ISP does not send an IP address . Your ISP sends an IP address ,so no matter what you specify in the Control Panel , you are given the 188.12.156.0

If your server program returns this IP using gethostbyname() , it does it probably because you have specified it in the control panel . You should remote it , since this IP is valid only when you are connected . Thats why your client cannot connect to 188.... , because this is not a valid LAN IP .

In other words , remove the IP you entered in the control panel , and select "Obtain automatically an IP address" . Then your program will work .

If your server still returns 188... even if you are not connected , tell me it and we will see .
Avatar of lortega

ASKER

Well is strange that the unique variation is the third number, sometimes is 188.12.156.0 other is 188.12.155.0 or 188.12.157.0 no metter if I am (or not) connected to Internet.

note: my internet service IP is 204.96.116.2 (server) and obtain IP from ...
Avatar of lortega

ASKER

Well is strange that the unique variation is the third number, sometimes is 188.12.156.0 other is 188.12.155.0 or 188.12.157.0 no metter if I am (or not) connected to Internet.

note: my internet service IP is 204.96.116.2 (server) and obtain IP from ...
Avatar of lortega

ASKER

Well is strange that the unique variation is the third number, sometimes is 188.12.156.0 other is 188.12.155.0 or 188.12.157.0 no metter if I am (or not) connected to Internet.

note: my internet service IP is 204.96.116.2 (server) and obtain IP from ...
Avatar of lortega

ASKER

Well is strange that the unique variation is the third number, sometimes is 188.12.156.0 other is 188.12.155.0 or 188.12.157.0 no metter if I am (or not) connected to Internet.

note: my internet service IP is 204.96.116.2 (server) and obtain IP from ...
Avatar of lortega

ASKER

Well is strange that the unique variation is the third number, sometimes is 188.12.156.0 other is 188.12.155.0 or 188.12.157.0 no metter if I am (or not) connected to Internet.

note: my internet service IP is 204.96.116.2 (server) and obtain IP from ...
In that case , I am not sure why Windows sends you back this address . I suggest sending me the part of your code that you use to obtain the IP address . Anyway , 127.0.0.1 works ALLWAYS , no matter if you are connected or not ...
Avatar of lortega

ASKER

DELPHI Developer 2.0


    //*************************
    //** get host Name & IP
        GetHostName(mName,100);
        pHostEntry:=GetHostByName(mName);
        if pHostEntry = nil then
         begin
           ShowMessage(IntToStr(WSAGetLastError)+' : Unable to get Host IP...');
           form1.Caption:=' Server ' + mName ;
         end
        else
         begin
           GetMem(inad,sizeof(TInAddr));
           CopyMemory(inad,pHostEntry.h_addr_list,4);
           form1.Caption:=' Server ' + mName + ' on address (' + inet_ntoa(inad^)+ ')';
         end;


results:
mName = lortega
inet_ntoa(inad^) = 188.12.156.0
Your code is correct for me . This IP is valid if you are connected . If you are not connected and the program still returns this IP , *and* you have NOT selected that as the default IP address in the Control Panel . I do not know what is the problem , try reinstalling the TCP/IP .

In all cases , anyway , you can modify your programs to use 127.0.0.1 always , when connecting to your local server - 127.0.0.1 works all the times .
Avatar of lortega

ASKER

127.0.0.1 is OK, but how can I be sure wich computer Iam connected if all computers responds to the same numbers???
What do you mean , you are not sure if you are connected to internet or not , by the time you are connecting to 127.0.0.1 ?

You need not know

There is no possibility 127.0.0.1 is used for a "real" IP address , it is reserved for loopback - only for your system .
Avatar of lortega

ASKER

I thinks you are a good help WxW, but as I see a lot of issues in winsock and this aplication is not for internet or bigs net, i prefer to change to DDE over the LAN...

as your answer are good, I will apreceate and give you an A...
so good luck WxW and continue in that way...

att
lortega
Thanks for grading my answer
I think that a small re-configuration and/or reinstallation of TCP/IP will solve all the problems you will have using DDE ....