Login  
Search All Forums
Dart Home | PowerTCP Server for ActiveX | Custom Development Reply | PowerTCP Server for ActiveX Topics | Forums   
AuthorForum: PowerTCP Server for ActiveX
Topic: Question about connect/receive data sequence
bradbritton

From: Red Deer, AB Canada
Posts: 14
Member Since: 02/09/06
posted February 9, 2006 6:10 PM

I am setting up a server that receives data from a device in the field. To get the data must one setup each one of these in the program;

  Dim modemIP As New System.Net.IPEndPoint(System.Net.IPAddress.Any, tcpPort)
      Server1.Listen(tcpPort) ' listens for connection
      Server1.Socket.Connect(modemIP) 'connects with remote host
      Server1.Socket.BeginAccept() 'sends accept to host
      Server1.Socket.BeginConnect() 'starts connect sequence
      Server1.Socket.Connect() ' connects to host
      Server1.Socket.BeginReceive() ' gets data from host
      Server1.Socket.BeginDisconnect(True) ' when all data is received, send disconnect
      Server1.Socket.Disconnect(True) ' disconnect from host

Any help would be A+++ as I have been beating my head against the wall all day trying to get this to work! The examples are ok, but not that clear on the site.

Thanks,

Brad
Tony Priest



From: Utica, NY USA
Posts: 8466
Member Since: 04/11/00
posted February 9, 2006 7:28 PM

The code you posted does not appear to be from one our controls. If is from our control then I am unclear what exactly you are trying to accomplish.

In an earlier thread, you stated that you had our sample working. Which sample were you referring to? Let's start there and try and determine what is unclear.
bradbritton

From: Red Deer, AB Canada
Posts: 14
Member Since: 02/09/06
posted February 10, 2006 1:15 PM

Here is the "break down" of the system :-)

I have a device that will sit in the field and send data back to the office server once a day. What I need to accomplish is the receiving of this data via the use of PowerTCP. The reason I am using this solution is due to the fact that it will handle the multiple connections for me. What I am unsure about is if I am using the "Server" portion of PowerTCP or the "TCP" portion, or a combination of both together in the application. Any pointers would be great!

Thanks,

Brad
Tony Priest



From: Utica, NY USA
Posts: 8466
Member Since: 04/11/00
posted February 10, 2006 1:26 PM

You would need to use both.

The device would be the client and you would write a program with the Tcp component to connect to office.

The office would be the server and you would write a program using the Server component.

Take a look at the TcpClient and Echo Server samples for the simplest examples.



bradbritton

From: Red Deer, AB Canada
Posts: 14
Member Since: 02/09/06
posted February 10, 2006 1:40 PM

When I am accepting the data from the modem in the field, must I negotiate connection with the unit? I am fairly new to TCP/Socket programming.

Thanks,

Brad
Tony Priest



From: Utica, NY USA
Posts: 8466
Member Since: 04/11/00
posted February 10, 2006 1:53 PM

Well, you wouldn't accept data from the Modem. You would accept the data from the TCP-IP layer.

How exactly is the modem "connecting" to your computer?

bradbritton

From: Red Deer, AB Canada
Posts: 14
Member Since: 02/09/06
posted February 10, 2006 2:18 PM

It is sending the data to our static IP, then our firewall is forwarding it to the server. We are using the DNS server to be able to connect to the modem. Basically how the modem works is that it fills the buffer and sends data, or waits 2 seconds and then sends it. I have ensured that I am getting the data at my PC because I am able to resolve the IPEndPoint from the data. But in terms of actaully getting data I have been unsuccessfully via TCP (however UDP wasnt an issue) but due to the reliability of the data we needed to switch to TCP.
Tony Priest



From: Utica, NY USA
Posts: 8466
Member Since: 04/11/00
posted February 10, 2006 2:23 PM

Are you sure that it is sending TCP?
What port are you sending it to?
bradbritton

From: Red Deer, AB Canada
Posts: 14
Member Since: 02/09/06
posted February 10, 2006 2:53 PM

Modem is set to send via TCP or UDP. I just checked and it is set to TCP. Port # is 54321.
Tony Priest



From: Utica, NY USA
Posts: 8466
Member Since: 04/11/00
posted February 10, 2006 3:01 PM

Start the Echo Server listening on port 54321
Now go to the command prompt and type:

telnet localhost 54321

and hit enter

Did you connect? If you type, do you see the character you typed? If so the server is working.

Now go to another machine and try, but instead of localhost, type the ip of the machine where the server is running.

bradbritton

From: Red Deer, AB Canada
Posts: 14
Member Since: 02/09/06
posted February 10, 2006 7:06 PM

I was able to connect. All i am really looking for is some pointers to setup a connection via TCP, read in the data to a bit array and then work with it. Although I am really looking forward to getting this going, if I can't get some results by monday the boss is going to scrap us using this product. There should be some better example on reading data in on the site, which would be helpful. The examples are good, but when you are developing it takes alot of time to get to the meat of someone elses code. Just some simple "listen", "connect" and "read data" to a file would be good to have. Any pointers would be a++++

Thanks,

Brad
Tony Priest



From: Utica, NY USA
Posts: 8466
Member Since: 04/11/00
posted February 10, 2006 7:13 PM

The problem is, it can't get much simpler than the echo server example. It would help a great deal if you could tell me which part of the sample is giving you a problem. Can you see the part where we read in the data, then send the data back? If so, then the next sample to look at would be the WebServer which reads a request, then sends the requested page back to the client.

Please help me to understand what you don't understand and I will try to help.

Reply | PowerTCP Server for ActiveX Topics | Forums   
This site is powered by PowerTCP WebServer Tool PowerTCP WebServer for ActiveX