• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 313
  • Last Modified:

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++
0
lortega
Asked:
lortega
  • 21
  • 15
  • +2
1 Solution
 
Tommy HuiEngineerCommented:
You can use Winsock on Windows 3.11 and Win95 as well as NT.
0
 
lortegaAuthor Commented:
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...
0
 
lortegaAuthor Commented:
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...
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
WxWCommented:
Comment following explaing what you have to do...
0
 
WxWCommented:
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()
0
 
WxWCommented:
If you need more help , just ask :)
0
 
lortegaAuthor Commented:
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...
0
 
abesoftCommented:
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?  
0
 
WxWCommented:
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

0
 
WxWCommented:
Whoops sorry , that was a comment :)
0
 
lortegaAuthor Commented:
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...
0
 
lortegaAuthor Commented:
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...
0
 
lortegaAuthor Commented:
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...
0
 
lortegaAuthor Commented:
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...
0
 
WxWCommented:
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
0
 
ArkadiyCommented:
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.
0
 
lortegaAuthor Commented:
some have some usefull code! (preferebly Delphi or C) not MFC
0
 
WxWCommented:
Try this :

char MyHostName[1000];
sockaddr_in saddr;
short PortToBind; // This holds the port you want to bind the //socket
SOCKET s; // this holds a created socket
int len = sizeof(sockaddr_in);

gethostname(MyHostHere,1000);
hostent* hp = gethostbyname(MyHostHere);
if (!hp)
   // .. error here
// else
memcpy(&saddr.sin_addr.s_addr,hp->h_addr,hp->h_length);
saddr.sin_family = AF_INET;
saddr.sin_port = htons(PortToBind);
if (bind(s,(sockaddr*)&saddr,len) != 0)
// error here...
// else
if (listen(s,3) != 0)
// error here

sockaddr_in sNew;
SOCKET NewSocket = accept(s,(sockaddr*)sNew,&len);
Now you can use NewSocket to transfer data from your server to the client that connected
0
 
lortegaAuthor Commented:
When I am connected to the internet
           I get addres 200.17.68.0

When Iam not I get
           Error 11004!
0
 
WxWCommented:
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
0
 
lortegaAuthor Commented:
Winsock 2 is available for Win95 ?
0
 
lortegaAuthor Commented:
How did you get  127.0.0.1 as LAN Address?
0
 
lortegaAuthor Commented:
How did you get  127.0.0.1 as LAN Address?
0
 
WxWCommented:
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 .
0
 
lortegaAuthor Commented:
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?
0
 
WxWCommented:
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 .
0
 
lortegaAuthor Commented:
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 ...
0
 
lortegaAuthor Commented:
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 ...
0
 
lortegaAuthor Commented:
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 ...
0
 
lortegaAuthor Commented:
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 ...
0
 
lortegaAuthor Commented:
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 ...
0
 
WxWCommented:
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 ...
0
 
lortegaAuthor Commented:
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
0
 
WxWCommented:
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 .
0
 
lortegaAuthor Commented:
127.0.0.1 is OK, but how can I be sure wich computer Iam connected if all computers responds to the same numbers???
0
 
WxWCommented:
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 .
0
 
lortegaAuthor Commented:
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
0
 
WxWCommented:
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 ....
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 21
  • 15
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now