Mr.M 89 Future Programmers

Ok on this router under the firewall Switch there was these options:

Enable firewall ---> this was enabled
Enable IP address filter
Disable WAN port ping ---> this was also enabled
Enable domain name filter
Enable MAC filter

I will disable the firewall and see if it connect tomorrow because a person who has helping me with the client side test is now asleep and he is in another province. I'm hoping that it was this router firewall that is blocking the connection.

Mr.M 89 Future Programmers

maybe I should also include that I'm connected to the router over wifi connection not with cable.

Mr.M 89 Future Programmers

Hi, Well it still doesn't connect and I'm not sure if it me or but it seems as if there is something really off here.

The server is not what I'd touch. The client needs to find this server so whatsmyip is run on the server. And you supply that IP to the client.

If I don't add the IP address on the server listener it will listen to 192.168.8.100 and the client I've issued it the IP address that was displayed by whatismyip.org but these two IP address are not the same, which makes me wonder how will a client route or connect to the server as my Public IP address is something else very different then the local IP address of which my server listens to?

Also the DMZ I've also enabled the IP 192.168.8.100 but still it doesn't connect. What am I missing here because it looks like there is something I'm missing here.

Mr.M 89 Future Programmers

Ok thanks will test this out tomorrow and see if it does connect and I will update you. Thanks again, and please bear with me, I'm pretty new to this.

Mr.M 89 Future Programmers

https://www.google.com/search?q=what+is+my+internet+ip+address&ie=utf-8&oe=utf-8 should show your internet IP address. This for most is what the SERVER IP address would be. After that, the router would be configured so your server gets the messages.

Well now the problem is that the IP address displayed when clicking that link or at http://www.whatismyip.org the server gives me Error 10049. Do I have to keep the server with the local IP address and on the client assign this IP address displayed by the link above or still this will not work? Also I've saw some other articles with similar problem some were recommended to use DynDNS and I've also registered there but the site I used was .org and on my router they is only one option which is for that ending with .com and I've checked it, it costing so as I'm testing I would like to go with the one that I already have which is a free service.

Any help here or should I assign that IP address as Static IP on my computer?

I really don't know what to do here now.

Mr.M 89 Future Programmers

Thanks now I get you. Thanks and yes this is my first TCP/IP based application.

Mr.M 89 Future Programmers

To connect to the server your server IP is the internet IP the router obtained, which is not 192.168.8.xxx

You mean I will have to assign another IP address different from this? even my gateway uses a similer IP only the last parts is different. My full IP is 192.168.8.100

Mr.M 89 Future Programmers

Thanks but can you please enlighten me into details what you are saying. Sorry just that this thing has messed with my head a lot now.

Mr.M 89 Future Programmers

192.168.8.xxx

Mr.M 89 Future Programmers

Thanks but I didn't get any of what you are saying. The "myServer IP HERE" is where I write my server IP Address.

Mr.M 89 Future Programmers

Ow the file was a zip file. here is a part of server which listen for the incoming connections:

        Dim IPHostt As IPHostEntry
        IPHostt = Dns.GetHostByName(Dns.GetHostName)
        Form1.txtIPAddress.Text = IPHostt.AddressList(0).ToString
        Dim locIP_toStart As String = "myIPAddress here"
        Dim locIP_Address As System.Net.IPAddress = System.Net.IPAddress.Parse(locIP_toStart)
        'MsgBox(locIP_Address.ToString)
        'Form1.txtIPAddress.Text = locIP_Address.ToString
        Dim listener As New System.Net.Sockets.TcpListener(locIP_Address, localTCP_Port)
        listener.Start()

        Form1.lblStatus.Text = "Online"

        While True

            Dim tmstokvel As New TMStokvelClient(listener.AcceptTcpClient)
        End While

and here is my client which tries to connect to a server.

Do While clientSocket.Connected = False
            Try
                'clientSocket.Connect("127.0.0.1", 8888)
                'status = "Connecting..."
                'Timer2.Start()
                If clientSocket.Connected = False Then
                    Try
                        clientSocket.Connect("myServerIP here", 3234)
                        status = "Connecting..."
                        If clientSocket.Connected = True Then
                            status = "Online"
                            'Timer2.Start()
                        Else
                            status = "Connecting..."
                            clientSocket.Connect("myServer IP here", 3234)
                            'Timer2.Start()
                        End If

                    Catch ex As Exception
                        'MsgBox(ex.Message)
                    End Try
                Else
                    If clientSocket.Connected = True Then
                        status = "Online"
                        'Timer2.Start()
                        'btnRegister.Enabled = True
                        'Timer2.Stop()
                        ' btnRegister.Enabled = True
                    Else
                        status = "Offline"
                        clientSocket.Connect("myServer IP Her", 3234)
                        'Timer2.Start()
                    End If
                End If
            Catch ex As Exception

            End Try

        Loop
Mr.M 89 Future Programmers

Hi guys. I'm having a very serious problem. I've created Client,Server Socket applications and they work great on local mechine and I also created a test Windows Phone 7 app and configured the static IP address and the wp7 and server does connect when I run WP7 on a simulater, but the problem is with my PC client application when execued on another computer on a WAN its doesn't connect to the server.

I've open the port for both Private and public network on my firewall and also forwarded the port on my router I've used all the options available on the router for port forwarding including:

1) Virtual server.
2) Special applications
3) DMZ settings.

but still its not connecting. I'm using port number "3234".
The clien side can be downloaded here.

Any suggestion on how I can make this work?

Mr.M 89 Future Programmers

This example looks like it will solve my number (4) problem.

Mr.M 89 Future Programmers

Hi Dw.

I'm a bit new to C# I'm used to program with VB.NET and one of my project had force me to do it with C# as I'm sure you are aware that VB.NET it lack with Windows Phone Socket programming APIs or support and C# does support it so my app is a TCP/IP based app. It uses a chat approach but the difference is that in my app a user only type in the credentials (Login details) and login then from there s/he should be presented with a list of data retrieved/sent by a server to this client.

I've got a couple of issues/problems namely:
1) In my server the server assumes that the data sent by a client is Bytes so it convert it using ...ASCII.GetString(data) but the problem is that in my Windows Phone app I don't know how to convert the data from string to byte using the ASCII format. I have this on my windows phone:

    string SendMessageToServer = myclient.Connect(myip,myport);
            SendMessageToServer = myclient.Send("Login:<" + txtUsername.Text + ">:<" + passwordBox1.Password);

As you can see the format of the request to login from a client to a server. The server will then look for signal of which here its Login but that is done after the data has been converted. The problem is that I want all my systems/clients to use the same format so that I wont have many servers for different platforms(Computers, Mobiles).

2) The server when sending the responce …

Mr.M 89 Future Programmers

Well, I also use VB5.0 when desiging some sort of applications and also do applications with VB.NET and what I've known is that theres no tool that really convert from VB5.0 to .NET even the 6.0 at lease I didn't find the convertor. I love them both the 5.0 and .net.

The solution if you are not planning to use 5.0 is to recode your app with VB.NET then, also the older versions there are a few people who still has it and knows it most people are flowing with the flow.

Mr.M 89 Future Programmers

My program is exactly the same as that on the link, but instead of keeping the hash's in a variable I log it(write it on a file on each line)

The line is in this format:

Hash_here Separator File_Name

Mr.M 89 Future Programmers

Well to correct some of the things within your code.
1) First of all on your Button1 I think you want when you click it shows the FolderBrowserDialog and when click ok you assign the path to a textbox. This is how to do it.

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
FBD.Show()
REM: Now check to see if the path is not empty
If FBD.SelectedPath = "" Then
REM: Handle here the empty path
Else
REM: The path is not empty so assign it to textbox
TextBox1.Text = FBD.SelectedPath.ToString
End If
End Sub

2) You need to open a file read it lines either all in one or one line at a time and search for your match and if you find it replace it. Also this should be done in a loop so that you wont write many lines, a For Each loop will help loop through each file in an array collection and do desired work for each file.

A simple googling would have helped you as this has some answers online.
Here is how to use regex , heres another way as well , Also this a simple google would have gave you answers. Hope this help you. I think this may also help

Mr.M 89 Future Programmers

Thanks that was my problem on how I could loop through this, I knew I need to loop through it but didn't know how because when I try For Each MyRow As DataRow In dvt.Rows it didn't do what I wanted till I find this.

Mr.M 89 Future Programmers

Any help?

Mr.M 89 Future Programmers

Hi Dw.

I'm using this code available from here and I have changed it from keeping the hashs on a variable(array) to writing it on a file. Now what I want to do is to read this file.

Basically I'm scanning through all my drive file and for each file I hash it and its hash code I save it on a text file on its own line and I have a special separator then a file name. So what I want to do is to read through the text file and get the names and on each file I chech if it does exist on the text file and then read the hash to a variable then hash the file again now I hash to only see if the file has ben modified or not. but the problem is that I don't know how will I convert the hash read from text file line because it is read as a string so it can't compare a byte to a text.

any Idea how I could solve this.

Mr.M 89 Future Programmers

Any code we could look at?

Mr.M 89 Future Programmers

Now its gives me Unhandled exception at 0x00041910 in T.exe 0xC0000005: Access violation reading location 0x0000001e with options Break, Continue. I have added this:

 HRESULT hResult;
 hResult = WFS_SUCCESS;
 LPWFSRESULT lpResult = NULL;
 lphService = NULL;
 lphService=(LPHSERVICE)(lpResult->lpBuffer);

The same error is still printed on screen.
It also sometime point to lphService=(LPHSERVICE)(lpResult->lpBuffer) and say NullReferenceException was not handled, object reference not set to an instance of an object.

I'm trying all my best to make this work, yes I'm not a C++ dev.

Mr.M 89 Future Programmers

Oops I can see that the table got mixed, basically its a database table with 3 columns, 3 records.

Mr.M 89 Future Programmers

Hi Dw.

I have a MySql server database, and I'm polling data from the database. The problem I'm getting is that when I'm retrieving users activities I only get the first record only which is on Row(0) or the first record with that username. Suppose I have a database like this:

 `-------------------------------------------------
 |Activity     | ActUser      |Username  |
  -------------------------------------------------
 |working    |John             |Steve          |
  --------------------------------------------------
 |done         |thabo           |tomas         |
  -------------------------------------------------
 |confirmed|amanda        |Steve          |
  -------------------------------------------------`

Now the problem is retrieving all records with username (Steve). In the above example it should be 2 records retrieved one with John and another with amanda.

This is what I have:

 Try
 Dim dav As New MySqlDataAdabter(("select * from mydatabase.test where Username ='" & yUsername & "'"), rtConn)
 Dim dvt As New DataTable
 dav.Fill(dvt)
 If dvt.Rows.Count > 0 Then
 yActivity = dvt.Rows(0).Item("Activity") & ""
 yActUser = dvt.Rows(0).Item("ActUser") & ""
 REM: I send this data to the client like this:
 Dim resp As String
 resp = "YTREWQ:<" & yActivity & ">:<" & yActUser & ">"
 sendMessage(resp)
 End If
 Catch ex As Exception
 ErrorLog(ex.Message & vbCrLf)
 End Try

Any help here because currently I only receive the first record for this user which is the record with John in this case I don't receive with that amanda.

What am I missing/doing wrong here?

Mr.M 89 Future Programmers

Did you ever tried writing the code you want because you now have the code to print Items (Body) so why don't before the Body printing code write your header printing code, or simply formulate/format it then add the format above the body so that it will be printed on top followed by the Items(Body) and footer(Total)?

Mr.M 89 Future Programmers

Well because you not a modem manufacture, I think what will help you is to first detect USB/Ethernet cable insertion/removing. Every peripheral device connected to a computer usually first identifies it self into a computer and then offer/issue how it will be connected/contacted using(Port). So I think that might help as a start and my direct you to the right direction.

Once you have detected, you will have to check its description to see what it is: check this:

This is for detecting plugged and removed USB device with it drive letter:

 Public Enum WM_DEVICECHANGE_WPPARAMS As Integer
 DBT_CONFIGCHANGECANCELED = &H19
 DBT_CONFIGCHANGE = &H18
 DBT_CUSTOMEVENT = &H8006
 DBT_DEVICEARRIVAL = &H8000
 DBT_DEVICEQUERYREMOVE = &H8001
 DBT_DEVICEQUERYREMOVEFAILED = &H8002
 DBT_DEVICEREMOVECOMPLETE = &H8004
 DBT_DEVICEREMOVEPENDING = &H8003
 DBT_DEVICETYPESPECIFIC = &H8005
 DBT_DEVNODES_CHANGED = &H7
 DBT_QUERYCHANGECONFIG = &H17
 DBT_USERDEFINED = &HFFFF
 End Enum

 REM: Device info structure for table.

 Public Structure DEV_BROADCAST_HDR
 Public dbch_size As Int32
 Public dbch_devicetype As Int32
 Public dbch_reserved As Int32
 End Structure

 REM: Volume info Structure

 Private Structure DEV_BROADCAST_VOLUME
 Public dbcv_size As Int32
 Public dbcv_devicetype As Int32
 Public dbcv_reserved As Int32
 Public dbcv_uninmask As Int32
 Public dbcv_flags As Int16
 End Structure

 REM: Function to get drive letter

 Private Function GetDriveLetterFromMask(ByRef Unit As Int32) As Char
 For i As Integer = 0 to 25
 If Unit = (2 ^ i) Then
 Return Chr(Asc("A") + i)
 End If
 Next
 End Function

 REM: Implementation of WndProc() method

 Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)
 If QueryCancelAutoPlay = 0 Then
 QueryCancelAutoPlay = RegisterWindowsMessage("QueryCancelAutoPlay")
 End If
 If m.Msg …
Mr.M 89 Future Programmers

I meant lphService not hService.

Mr.M 89 Future Programmers

@nullptr you are correct indeed, as the error state 'invalid pointer' (-26) error and these posts support this: http://www.dev-hq.net/c++/19--dynamically-allocating-memory, http://www.cplusplus.com/doc/tutorial/dynamic/, http://www.tutorialspoint.com/cplusplus/cpp_dynamic_memory.htm

@jim also your first post support this and its the post which enlighten me on this. Also @jim I meant that variable that should return the handle.

Now my problem is how can I apply the memory allocation in my case. Also will I have to keep doing memory allocation for each function or only for Wfs_Open()?

Mr.M 89 Future Programmers

Thanks. I think I see where's the problem but I don't know how I can solve this. The problem I think is within my hService is there another better way to write this function other then this?

Mr.M 89 Future Programmers

If anyone could tell me what's really am I missing here, because even if I do as per the guide, I still get the same error. Please guys help me out here.

Mr.M 89 Future Programmers

Well I think its depends on the software type you are developing and also depends on its activities that it has to do. If your application will do activities that are assocciated with OS\Kernel then you will need to do that in low level language(s) like C++, but if there are already available resources as many developers out there each and every day try to innovate even the development of software meaning there are some groups who do develop things like DLL libraries which this can be used in High level programming languages which means now there are enterprise software that can be done in high level programming languages but with help of these libraries.

Some enterprise can also be done with High Level programming languages without the need of low level, but this send us back to that it depends on the activities your application will be performing.

But C++, Assemble are a must to have high quality software in terms of their performance/activities as with these languages you can do very deep activities including accessing/modifying assemble and more activities that work much close with OS files.

Mr.M 89 Future Programmers

Lol ;-) wow. But what about our clients that uses these devices though? I was planing to develop apps for Android, Blackberry, and Windows Phone, and after that look into IOS.

So you mean I should leave this project?

Mr.M 89 Future Programmers

Mmmmm Well I can see this seem to be not easy to point out. But What I've thought was to create another table and on that table I will only add the the user who is booking another as a username then for the booked user I will add that user as a BookedUser then will have two select statements which the first one will check if the username is the same with the current logged in user and if so, then that record will be read and sent to the client. The second select will check if the BookedUser is the same with the current logged in user, if so all record with this should be read and sent to the user.

I think the same problem will occure here. Let say admin has booked test which means under the username there will be admin and under BookedUser there will be test so now I think this will also be a problem when let say test has also booked let say John. The problem will be that I'm polling the data and on the client side I first check if the data being received has the same username as that on the ListView if so I don't add that data to prevent getting the same data over and over. But what I think is that I will try to add another verification method so that I can have more then one transactions displayed on the ListView with the same …

Mr.M 89 Future Programmers

Hi Dw.

Has anyone worked with TCP/IP socket in Windows Phone? I'm using Windows Phone 7 and I would like my app to communicate with my server which my client will send some data to the server and the server will also send some data to the client, It's more like chat server, but I'm not using it for chatting. I need some resources/source/samples. I've found samples but there are in C# and I tried converting it to VB.NET but it seems the code used doesn't match when converted to VB.NET.

Mr.M 89 Future Programmers

Well what I've found out in my code when got the same error was that the formated cells is a bit sensitive to the data entered, so the best way to track when/where exactly the error occures you need to add a MsgBox("Number_here") above each and every code that will be fired so that you will see which part is producing an error. In my case the problem was that I formated the cell to varcha for the date and when I try to enter the date I don't really know what was the problem but I change the way I retrieve/get today's date and it worked if I make it to Shortdate.

In short, there maybe a data that might be in an incorrect format or has some extra charectors not really sure but try evaulate which part of code is producing this error and change the way your data is formated for that part.

Mr.M 89 Future Programmers

Any Help with this? My problem is retrieving data of the same username in the third or so record. eg. for the above example I want to display/retrieve the second test username record not the first one but the other record. in My app it seems as if it tries to retrieve the first test record.

Mr.M 89 Future Programmers

Yes my conn is a global variable. But the error just occure even if I run one app. About your suggestion of every thread to have it's own connection. I sense an even more code to write, also won't that when I run multiple applications/clients also give me the very same problem. What I was thinking is to make the connection also a multithreaded so that each thread will have its own connection. But my problem is how can I achieve that?

Mr.M 89 Future Programmers

Hi Dw.

I'm deeply in need of your help, I'm having a problem that is giving me a very serious problem with my code.

My program is a multithreaded program and its a TCP/IP based application. Client has no problem, only a server that is being so weid to me now. The client sends signals to the server and a server will perform an action according to the client's signal, and as it's a multithreaded app the server can receive many different signals as well as many same signals at the same time. When I used Microsoft Access it was working fine, mean it did everything the way i coded it to. The only problem I had was the connection limit which I was then advised to change to MySQL server and I did download and set it according to my MS Access database.

Now the problem is within the connection request to server database it says Connection already open What I want is to make this support multithread access to the database. Here's my connection code:

Public Sub ConnDB()
        Try
            conn = New MySqlConnection
            conn.ConnectionString = "server=localhost;userid=root;password=mypassword;database=mydatabasename"
            conn.Open()
        Catch ex As Exception
            Debug.Write(ex.ToString())
            MsgBox(ex.ToString & " Im ConnDB")
        Finally

            conn.Dispose()
            conn.Close()
            'MsgBox(ex.Message)
            'MsgBox("Failed in Connecting to database")
            'conn.Open()
        End Try
        conn.Close()
    End Sub

Here's my code which I get a problem with.

If pp = "" Or pp = "0" Then
                                                                            If CInt(amount) = CInt(OriginalAmount) Then
                                                                                REM: The user want to deposit all the amount
                                                                                Try
                                                                                    MsgBox("3")
                                                                                    conn.Open() …
Mr.M 89 Future Programmers

Ok Thanks to everyone. When I was developing another client server chat app I came across an answer to this problem. The solution is that you are able to send data to a computer/client by specifying the target ip address. For locating the user that's a servers job and the server will look for that username the user wish to contact and within that user record in the database it will look for the ip address field and retrieve that and send it to that client requesting it. This is like, The first client will enquire the server to where the second client is contacted then a server will look that from the database then send that contact ip to the requesting client.

As for termination the server will also look for the requesting client balance from the database then send that if that client has enough balance then the connection will be permited and a duration will also be sent to the client. The client will then attempt to connect to that client and once connected the client will then be connected for the stated duration.

Mr.M 89 Future Programmers

Thank you a million times. This all turns out to be the miner action I did at first which produced this error.

For someone who might as well experience the same problem. First of all, before installing MySQL server using installer for the first time, you need to ensure that on your system there are no tools which will come with an installer are already running in your system, this include Workbench, installer. Or should I say if you had installed these first before the actual MySQL server, you need to unInstall them first then always run an installer.

My problem was that I first installed these things and when I try to install the server it tries to look for already existing files but it don't find it because it does detect that some of its components have been installed on this system.

Thank you guys. You be best! Now I will start searching on how to create a database/tables/add data and so on. Thank you Dani again.

Mr.M 89 Future Programmers

Well I don't know whats the problem with this. Ive redownloaded the installer and tried it, got same problem, unInstalled the previous but Still when I try to install this same error is shown.

Mr.M 89 Future Programmers

Unrelated suggestion - in some databases

Ow you mean in the where section? Thanks about that didn't know of it.

Mr.M 89 Future Programmers

Yes I have some other columns which are unique as well. I have a Status which is unique. This what Happens I have a table like this:

----------------------------------------------------------------------------
username|BookedUser|Amount|Status|RefNo|DueDate    |Id     |Rec |Remainder |
----------------------------------------------------------------------------
test      |Admin      |500  |Offered  |N82XP3|05/28/2016|Offer|0   |0         |
Admin   |0        |1000 |Open     |N82XP3|05/26/2016|Owner|0   |500       |
test    |0        |6000 |Scheduled|KZ95AV|05/30/2016|Owner|0   |0         |
----------------------------------------------------------------------------

Ok My database is like this. Now taking the username and password sample I used on my first post I was actually refering to username and BookedUser columns. I also check Status as I only want to return only record with these status (Offered,Scheduled,Paid) and each status is retrieved as per the Id as actions for Offer are not the same as actions for Owner. Now the trick is that each user can be in a database unlimitedly with different Id,Status.

basically what I want to achieve is "I will just say it as is" I want to retrieve all records where this username is in BookedUser and the status for that record is one of these I mentioned that I only want to retrieve records with it. Also I want to retrieve all records with this username in username field where the status is one of the above mentioned status's.

Hope this is more clear. The reason is that both Offer and Owner are using the same function to access the database but I first retrieve the data from the database and check return the Id for that particular username so that …

Mr.M 89 Future Programmers

Hi Dw.

What is the correct way to write an sql query like this? "select * from MyTable where username ='username' And password ='Password'" in vb.net.

My problem is that on my database I have some usernames repeated but they differ by their passwords. Each record has a different information. When I tried this it will just return the wrong data especially if the intended record is not in the first same username record, it will just retrieve the first same username records, but I want to force it to only retrieve all data on the record where username and password match.

Any idea?

Mr.M 89 Future Programmers

I downloaded it there, but downloaded the offline install. Well will try redownloading it again if this continues then I will download the older version and see,

Mr.M 89 Future Programmers

The first step is to declare an integer variable which will hold the amount of which you will deduct (minus) the amount to be transferred. Also you need to convert the data retrieved to integer so that you will be able to do deductions.

After that you will need to first do similar thing, create another integer variable to hold the amount that is currently on the Transfer To form then add that amount with the amount deducted and then push/update the Transfer To amount with the total calculated.

That's how to achieve what you want or use hidden labels.

Mr.M 89 Future Programmers

Oops sorry I miss typed it when typing here, it ProgramData there's no s.

Mr.M 89 Future Programmers

I don't see enrol button here. Also state exactly what's giving you problem in which line so that it will be a bit easier for us to help you, as to this question I still don't see the part you say you have a problem with "enrol button" or maybe your question is how to create the enrol button?

Please clarify your question.

Mr.M 89 Future Programmers

Hi Dw.

I'm trying to install MySQL and its my first time to install MySQL. I've downloaded the latest version which is version 5.7.12 and when I try to install its says "Beginning configuration step: Stopping Server [if necessary]
Ended configuration step: Stopping Server [if necessary]

Beginning configuration step: Writing configuration file
Path cannot be the empty string or all whitespace
Ended configuration step: writing configuration file"

I've saw another post on stackoverflow on someone who had the same problem but he/she was using version 5.7 and the solution was that he/she had to create a folder "MySQL 5.7" on "C:\ProgramsData\MySQL" I also tried this but nothing, the error still shows.

Am I missing something here?

Mr.M 89 Future Programmers

Well you say you are confused in enrol button but show nothing, also the number of pages depends on how you design your system(site). That means if certain things you will separate to each page or combine some that feet into certain category and group them by categories